CM3D2 Converter

  1# アドオンを読み込む時に最初にこのファイルが読み込まれます
  2
  3# アドオン情報
  4bl_info = {
  5    "name": "CM3D2 Converter",
  6    "author": "@saidenka_cm3d2, @trzrz, @luvoid",
  7    "version": ("luv", 2023, 6, "11a"),
  8    "blender": (2, 80, 0),
  9    "location": "ファイル > インポート/エクスポート > CM3D2 Model (.model)",
 10    "description": "カスタムメイド3D2/カスタムオーダーメイド3D2専用ファイルのインポート/エクスポートを行います",
 11    "warning": "",
 12    "wiki_url": "https://github.com/luvoid/Blender-CM3D2-Converter/blob/bl_28/README.md",
 13    "tracker_url": "https://github.com/luvoid/Blender-CM3D2-Converter",
 14    "category": "Import-Export"
 15}
 16
 17# サブスクリプト群をインポート
 18if "bpy" in locals():
 19    import imp
 20
 21    imp.reload(compat)
 22    imp.reload(common)
 23    imp.reload(cm3d2_data)
 24
 25    imp.reload(model_import)
 26    imp.reload(model_export)
 27
 28    imp.reload(anm_import)
 29    imp.reload(anm_export)
 30
 31    imp.reload(tex_import)
 32    imp.reload(tex_export)
 33
 34    imp.reload(mate_import)
 35    imp.reload(mate_export)
 36
 37    imp.reload(menu_file)
 38    imp.reload(menu_OBJECT_PT_cm3d2_menu)
 39
 40    imp.reload(misc_DATA_PT_context_arm)
 41    imp.reload(misc_DATA_PT_modifiers)
 42    imp.reload(misc_DATA_PT_vertex_groups)
 43    imp.reload(misc_IMAGE_HT_header)
 44    imp.reload(misc_IMAGE_PT_image_properties)
 45    imp.reload(misc_INFO_HT_header)
 46    imp.reload(misc_INFO_MT_add)
 47    imp.reload(misc_INFO_MT_curve_add)
 48    imp.reload(misc_INFO_MT_help)
 49    imp.reload(misc_MATERIAL_PT_context_material)
 50    imp.reload(misc_MESH_MT_attribute_context_menu)
 51    imp.reload(misc_MESH_MT_shape_key_specials)
 52    imp.reload(misc_MESH_MT_vertex_group_specials)
 53    imp.reload(misc_OBJECT_PT_context_object)
 54    imp.reload(misc_OBJECT_PT_transform)
 55    imp.reload(misc_RENDER_PT_bake)
 56    imp.reload(misc_RENDER_PT_render)
 57    imp.reload(misc_TEXTURE_PT_context_texture)
 58    imp.reload(misc_TEXT_HT_header)
 59    imp.reload(misc_VIEW3D_MT_edit_mesh_merge)
 60    imp.reload(misc_VIEW3D_MT_edit_mesh_specials)
 61    imp.reload(misc_VIEW3D_MT_edit_mesh_split)
 62    imp.reload(misc_VIEW3D_MT_pose_apply)
 63    imp.reload(misc_VIEW3D_PT_tools_weightpaint)
 64    imp.reload(misc_VIEW3D_PT_tools_mesh_shapekey)
 65    imp.reload(misc_DOPESHEET_MT_editor_menus)
 66
 67    imp.reload(translations)
 68
 69else:
 70    from . import compat
 71    from . import common
 72    from . import cm3d2_data
 73
 74    from . import model_import
 75    from . import model_export
 76
 77    from . import anm_import
 78    from . import anm_export
 79
 80    from . import tex_import
 81    from . import tex_export
 82
 83    from . import mate_import
 84    from . import mate_export
 85
 86    from . import menu_file
 87    from . import menu_OBJECT_PT_cm3d2_menu
 88
 89    from . import misc_DATA_PT_context_arm
 90    from . import misc_DATA_PT_modifiers
 91    from . import misc_DATA_PT_vertex_groups
 92    from . import misc_IMAGE_HT_header
 93    from . import misc_IMAGE_PT_image_properties
 94    from . import misc_INFO_HT_header
 95    from . import misc_INFO_MT_add
 96    from . import misc_INFO_MT_curve_add
 97    from . import misc_INFO_MT_help
 98    from . import misc_MATERIAL_PT_context_material
 99    from . import misc_MESH_MT_attribute_context_menu
100    from . import misc_MESH_MT_shape_key_specials
101    from . import misc_MESH_MT_vertex_group_specials
102    from . import misc_OBJECT_PT_context_object
103    from . import misc_OBJECT_PT_transform
104    from . import misc_RENDER_PT_bake
105    from . import misc_RENDER_PT_render
106    from . import misc_TEXTURE_PT_context_texture
107    from . import misc_TEXT_HT_header
108    from . import misc_VIEW3D_MT_edit_mesh_merge
109    from . import misc_VIEW3D_MT_edit_mesh_specials
110    from . import misc_VIEW3D_MT_edit_mesh_split
111    from . import misc_VIEW3D_MT_pose_apply
112    from . import misc_VIEW3D_PT_tools_weightpaint
113    from . import misc_VIEW3D_PT_tools_mesh_shapekey
114    from . import misc_DOPESHEET_MT_editor_menus
115
116    from . import translations
117
118import bpy, os.path, bpy.utils.previews
119
120
121# Backwards compatability
122if compat.IS_LEGACY:
123    bl_info["blender"] = (2, 78, 0)
124
125
126
127# アドオン設定
128@compat.BlRegister()
129class AddonPreferences(bpy.types.AddonPreferences):
130    bl_idname = __name__
131
132    cm3d2_path = bpy.props.StringProperty(name="CM3D2インストールフォルダ", subtype='DIR_PATH', description="変更している場合は設定しておくと役立つかもしれません")
133    backup_ext = bpy.props.StringProperty(name="バックアップの拡張子 (空欄で無効)", description="エクスポート時にバックアップを作成時この拡張子で複製します、空欄でバックアップを無効", default='bak')
134
135    scale = bpy.props.FloatProperty(name="倍率", description="Blenderでモデルを扱うときの拡大率", default=5, min=0.01, max=100, soft_min=0.01, soft_max=100, step=10, precision=2)
136    is_convert_bone_weight_names = bpy.props.BoolProperty(name="基本的にボーン名/ウェイト名をBlender用に変換", default=False, description="modelインポート時にボーン名/ウェイト名を変換するかどうかのオプションのデフォルトを設定します")
137    model_default_path = bpy.props.StringProperty(name="modelファイル置き場", subtype='DIR_PATH', description="設定すれば、modelを扱う時は必ずここからファイル選択を始めます")
138    model_import_path = bpy.props.StringProperty(name="modelインポート時のデフォルトパス", subtype='FILE_PATH', description="modelインポート時に最初はここが表示されます、インポート毎に保存されます")
139    model_export_path = bpy.props.StringProperty(name="modelエクスポート時のデフォルトパス", subtype='FILE_PATH', description="modelエクスポート時に最初はここが表示されます、エクスポート毎に保存されます")
140
141    anm_default_path = bpy.props.StringProperty(name="anmファイル置き場", subtype='DIR_PATH', description="設定すれば、anmを扱う時は必ずここからファイル選択を始めます")
142    anm_import_path = bpy.props.StringProperty(name="anmインポート時のデフォルトパス", subtype='FILE_PATH', description="anmインポート時に最初はここが表示されます、インポート毎に保存されます")
143    anm_export_path = bpy.props.StringProperty(name="anmエクスポート時のデフォルトパス", subtype='FILE_PATH', description="anmエクスポート時に最初はここが表示されます、エクスポート毎に保存されます")
144
145    tex_default_path = bpy.props.StringProperty(name="texファイル置き場", subtype='DIR_PATH', description="設定すれば、texを扱う時は必ずここからファイル選択を始めます")
146    tex_import_path = bpy.props.StringProperty(name="texインポート時のデフォルトパス", subtype='FILE_PATH', description="texインポート時に最初はここが表示されます、インポート毎に保存されます")
147    tex_export_path = bpy.props.StringProperty(name="texエクスポート時のデフォルトパス", subtype='FILE_PATH', description="texエクスポート時に最初はここが表示されます、エクスポート毎に保存されます")
148
149    mate_default_path = bpy.props.StringProperty(name="mateファイル置き場", subtype='DIR_PATH', description="設定すれば、mateを扱う時は必ずここからファイル選択を始めます")
150    mate_unread_same_value = bpy.props.BoolProperty(name="同じ設定値が2つ以上ある場合削除", default=True, description="_ShadowColor など")
151    mate_import_path = bpy.props.StringProperty(name="mateインポート時のデフォルトパス", subtype='FILE_PATH', description="mateインポート時に最初はここが表示されます、インポート毎に保存されます")
152    mate_export_path = bpy.props.StringProperty(name="mateエクスポート時のデフォルトパス", subtype='FILE_PATH', description="mateエクスポート時に最初はここが表示されます、エクスポート毎に保存されます")
153    
154    menu_default_path = bpy.props.StringProperty(name=".menu Default Path"       , subtype='DIR_PATH' , description="If set. The file selection will open here.")
155    menu_import_path  = bpy.props.StringProperty(name=".menu Default Import Path", subtype='FILE_PATH', description="When importing a .menu file. The file selection prompt will begin here.")
156    menu_export_path  = bpy.props.StringProperty(name=".menu Default Export Path", subtype='FILE_PATH', description="When exporting a .menu file. The file selection prompt will begin here.")
157    
158    is_replace_cm3d2_tex = bpy.props.BoolProperty(name="基本的にtexファイルを探す", default=True, description="texファイルを探すかどうかのオプションのデフォルト値を設定します")
159    default_tex_path0 = bpy.props.StringProperty(name="texファイル置き場", subtype='DIR_PATH', description="texファイルを探す時はここから探します")
160    default_tex_path1 = bpy.props.StringProperty(name="texファイル置き場", subtype='DIR_PATH', description="texファイルを探す時はここから探します")
161    default_tex_path2 = bpy.props.StringProperty(name="texファイル置き場", subtype='DIR_PATH', description="texファイルを探す時はここから探します")
162    default_tex_path3 = bpy.props.StringProperty(name="texファイル置き場", subtype='DIR_PATH', description="texファイルを探す時はここから探します")
163
164    custom_normal_blend = bpy.props.FloatProperty(name="CM3D2用法線のブレンド率", default=0.5, min=0, max=1, soft_min=0, soft_max=1, step=3, precision=3)
165    skip_shapekey = bpy.props.BoolProperty(name="無変更シェイプキーをスキップ", default=True, description="ベースと同じシェイプキーを出力しない")
166    is_apply_modifiers = bpy.props.BoolProperty(name="モディファイアを適用", default=False)
167
168    new_mate_tex_offset = bpy.props.FloatVectorProperty(name="テクスチャのオフセット", default=(0, 0), min=-1, max=1, soft_min=-1, soft_max=1, step=10, precision=3, size=2)
169    new_mate_tex_scale = bpy.props.FloatVectorProperty(name="テクスチャのスケール", default=(1, 1), min=0, max=1, soft_min=0, soft_max=1, step=10, precision=3, size=2)
170
171    new_mate_toonramp_name = bpy.props.StringProperty(name="_ToonRamp 名前", default="toonGrayA1")
172    new_mate_toonramp_path = bpy.props.StringProperty(name="_ToonRamp パス", default=common.BASE_PATH_TEX + "toon/toonGrayA1.png")
173
174    new_mate_shadowratetoon_name = bpy.props.StringProperty(name="_ShadowRateToon 名前", default="toonDress_shadow")
175    new_mate_shadowratetoon_path = bpy.props.StringProperty(name="_ShadowRateToon パス", default=common.BASE_PATH_TEX + "toon/toonDress_shadow.png")
176
177    new_mate_linetoonramp_name = bpy.props.StringProperty(name="_OutlineToonRamp 名前", default="toonGrayA1")
178    new_mate_linetoonramp_path = bpy.props.StringProperty(name="_OutlineToonRamp パス", default=common.BASE_PATH_TEX + "toon/toonGrayA1.png")
179
180    new_mate_color = bpy.props.FloatVectorProperty(name="_Color", default=(1, 1, 1, 1), min=0, max=1, soft_min=0, soft_max=1, step=10, precision=2, subtype='COLOR', size=4)
181    new_mate_shadowcolor = bpy.props.FloatVectorProperty(name="_ShadowColor", default=(0, 0, 0, 1), min=0, max=1, soft_min=0, soft_max=1, step=10, precision=2, subtype='COLOR', size=4)
182    new_mate_rimcolor = bpy.props.FloatVectorProperty(name="_RimColor", default=(0.5, 0.5, 0.5, 1), min=0, max=1, soft_min=0, soft_max=1, step=10, precision=2, subtype='COLOR', size=4)
183    new_mate_outlinecolor = bpy.props.FloatVectorProperty(name="_OutlineColor", default=(0, 0, 0, 1), min=0, max=1, soft_min=0, soft_max=1, step=10, precision=2, subtype='COLOR', size=4)
184
185    new_mate_shininess  = bpy.props.FloatProperty(name="_Shininess", default=0, min=-100, max=100, soft_min=-100, soft_max=100, step=1, precision=2)
186    new_mate_outlinewidth = bpy.props.FloatProperty(name="_OutlineWidth", default=0.0015, min=-100, max=100, soft_min=-100, soft_max=100, step=1, precision=2)
187    new_mate_rimpower = bpy.props.FloatProperty(name="_RimPower", default=25, min=-100, max=100, soft_min=-100, soft_max=100, step=1, precision=2)
188    new_mate_rimshift = bpy.props.FloatProperty(name="_RimShift", default=0, min=-100, max=100, soft_min=-100, soft_max=100, step=1, precision=2)
189    new_mate_hirate = bpy.props.FloatProperty(name="_HiRate", default=0.5, min=-100, max=100, soft_min=-100, soft_max=100, step=1, precision=2)
190    new_mate_hipow = bpy.props.FloatProperty(name="_HiPow", default=0.001, min=-100, max=100, soft_min=-100, soft_max=100, step=1, precision=2)
191    new_mate_cutoff = bpy.props.FloatProperty(name="_Cutoff", default=0.5, min=0, max=1, soft_min=0, soft_max=1, step=10, precision=2)
192    new_mate_cutout = bpy.props.FloatProperty(name="_Cutout", default=0.482143, min=0, max=1, soft_min=0, soft_max=1, step=10, precision=6)
193    new_mate_ztest = bpy.props.FloatProperty(name="_ZTest", default=4, min=0, max=8, soft_min=0, soft_max=8, step=1)
194    new_mate_ztest2 = bpy.props.FloatProperty(name="_ZTest2", default=1, min=0, max=1, soft_min=0, soft_max=1, step=1)
195    new_mate_ztest2alpha = bpy.props.FloatProperty(name="_ZTest2Alpha", default=0.8, min=0, max=1, soft_min=0, soft_max=1, step=1, precision=2)
196
197    bone_display_type = bpy.props.EnumProperty(
198        items=[
199            ('OCTAHEDRAL', "Octahedral", "Display bones as octahedral shape (default)."                            ),
200            ('STICK'     , "Stick"     , "Display bones as simple 2D lines with dots."                             ),
201            ('BBONE'     , "B-Bone"    , "Display bones as boxes, showing subdivision and B-Splines."              ),
202            ('ENVELOPE'  , "Envelope"  , "Display bones as extruded spheres, showing deformation influence volume."),
203            ('WIRE'      , "Wire"      , "Display bones as thin wires, showing subdivision and B-Splines."         ),
204        ],
205        name="Display Type",
206        default='STICK',
207    )
208    show_bone_names         = bpy.props.BoolProperty(name="Show Bone Names"       , default=False, description="Display bone names"                     )
209    show_bone_axes          = bpy.props.BoolProperty(name="Show Bone Axes"        , default=False, description="Display bone axes"                      )
210    show_bone_custom_shapes = bpy.props.BoolProperty(name="Show Bone Shapes"      , default=True , description="Display bones with their custom shapes" )
211    show_bone_group_colors  = bpy.props.BoolProperty(name="Show Bone Group Colors", default=True , description="Display bone group colors"              )
212    show_bone_in_front      = bpy.props.BoolProperty(name="Show Bones in Front"   , default=True , description="Make the object draw in front of others")
213
214    def draw(self, context):
215        if compat.IS_LEGACY:
216            self.layout.label(text="ここの設定は「ユーザー設定の保存」ボタンを押すまで保存されていません", icon='QUESTION')
217        else:
218            self.layout.label(text="設定値を変更した場合、「プリファレンスを保存」ボタンを押下するか、「プリファレンスを自動保存」を有効にして保存してください", icon='QUESTION')
219        
220        col = self.layout.column()
221        col.label(text="CM3D2 Converter Info")
222        factor = 0.25
223        split = compat.layout_split(col.row(), factor)
224        split.label(text="Add-on Version: ")
225        split.label(text=".".join(str(i) for i in bl_info["version"]))
226        split = compat.layout_split(col.row(), factor)
227        split.label(text="Branch: ")
228        split.label(text=common.BRANCH)
229        split = compat.layout_split(col.row(), factor)
230        split.label(text="Repo URL: ")
231        split.label(text=common.URL_REPOS)
232        split = compat.layout_split(col.row(), factor)
233        split.label(text="Blender Version: ")
234        split.label(text=".".join(str(i) for i in bpy.app.version) if hasattr(bpy.app, 'version') else "Legacy")
235        split = compat.layout_split(col.row(), factor)
236        split.label(text="Blender Language: ")
237        split.label(text=compat.get_system(bpy.context).language or 'None')
238        default_locale = 'UNKNOWN'
239        try:
240            import locale
241            default_locale = locale.getdefaultlocale()[0]
242        except:
243            pass
244        split = compat.layout_split(col.row(), factor)
245        split.label(text="Default Language: ")
246        split.label(text=default_locale)
247
248        self.layout.label(text="."*9999)
249        self.layout.label(text="Preferences:")
250
251        self.layout.prop(self, 'cm3d2_path', icon_value=common.kiss_icon())
252        self.layout.prop(self, 'backup_ext', icon='FILE_BACKUP')
253
254        box = self.layout.box()
255        box.label(text="modelファイル", icon='MESH_ICOSPHERE')
256        row = box.row()
257        row.prop(self, 'scale', icon=compat.icon('ARROW_LEFTRIGHT'))
258        row.prop(self, 'is_convert_bone_weight_names', icon='BLENDER')
259        brws_icon = compat.icon('FILEBROWSER')
260        box.prop(self, 'model_default_path', icon=brws_icon, text="ファイル選択時の初期フォルダ")
261
262        box = self.layout.box()
263        box.label(text="anmファイル", icon='POSE_HLT')
264        box.prop(self, 'anm_default_path', icon=brws_icon, text="ファイル選択時の初期フォルダ")
265
266        box = self.layout.box()
267        box.label(text="texファイル", icon='FILE_IMAGE')
268        box.prop(self, 'tex_default_path', icon=brws_icon, text="ファイル選択時の初期フォルダ")
269
270        box = self.layout.box()
271        box.label(text="mateファイル", icon='MATERIAL')
272        box.prop(self, 'mate_unread_same_value', icon='DISCLOSURE_TRI_DOWN')
273        box.prop(self, 'mate_default_path', icon=brws_icon, text="ファイル選択時の初期フォルダ")
274
275        box = self.layout.box()
276        box.label(text=".menu File", icon='COPY_ID')
277        box.prop(self, 'menu_default_path', icon=brws_icon, text="Initial folder when selecting files")
278
279        box = self.layout.box()
280        box.label(text="texファイル検索", icon='BORDERMOVE')
281        box.prop(self, 'is_replace_cm3d2_tex', icon='VIEWZOOM')
282        box.prop(self, 'default_tex_path0', icon='LAYER_ACTIVE', text="その1")
283        box.prop(self, 'default_tex_path1', icon='LAYER_ACTIVE', text="その2")
284        box.prop(self, 'default_tex_path2', icon='LAYER_ACTIVE', text="その3")
285        box.prop(self, 'default_tex_path3', icon='LAYER_ACTIVE', text="その4")
286
287        box = self.layout.box()
288        box.label(text="CM3D2用マテリアル新規作成時の初期値", icon='MATERIAL')
289        row = box.row()
290        row.prop(self, 'new_mate_tex_offset', icon='MOD_MULTIRES')
291        row.prop(self, 'new_mate_tex_scale', icon='ARROW_LEFTRIGHT')
292        row = box.row()
293        row.prop(self, 'new_mate_toonramp_name', icon='BRUSH_TEXFILL')
294        row.prop(self, 'new_mate_toonramp_path', icon='ANIM')
295        row = box.row()
296        row.prop(self, 'new_mate_shadowratetoon_name', icon='BRUSH_TEXMASK')
297        row.prop(self, 'new_mate_shadowratetoon_path', icon='ANIM')
298        row = box.row()
299        row.prop(self, 'new_mate_color', icon='COLOR')
300        row.prop(self, 'new_mate_shadowcolor', icon='IMAGE_ALPHA')
301        row.prop(self, 'new_mate_rimcolor', icon=compat.icon('SHADING_RENDERED'))
302        row.prop(self, 'new_mate_outlinecolor', icon=compat.icon('SHADING_SOLID'))
303        row = box.row()
304        row.prop(self, 'new_mate_shininess', icon=compat.icon('NODE_MATERIAL'))
305        row.prop(self, 'new_mate_outlinewidth', icon=compat.icon('SHADING_SOLID'))
306        row.prop(self, 'new_mate_rimpower', icon=compat.icon('SHADING_RENDERED'))
307        row.prop(self, 'new_mate_rimshift', icon='ARROW_LEFTRIGHT')
308        row.prop(self, 'new_mate_hirate')
309        row.prop(self, 'new_mate_hipow')
310
311        box = self.layout.box()
312        box.label(text="Default Armature Settings", icon='ARMATURE_DATA')
313        if not compat.IS_LEGACY:
314            box.use_property_split = True
315        box.prop(self, "bone_display_type", text="Display As")
316        if compat.IS_LEGACY:
317            flow = box.column_flow(align=True)
318        else:
319            flow = box.grid_flow(align=True)
320        col = flow.column(); col.prop(self, "show_bone_names",         text="Names"       )
321        col = flow.column(); col.prop(self, "show_bone_axes",          text="Axes"        )
322        col = flow.column(); col.prop(self, "show_bone_custom_shapes", text="Shapes"      )
323        col = flow.column(); col.prop(self, "show_bone_group_colors",  text="Group Colors")
324        col = flow.column(); col.prop(self, "show_bone_in_front",      text="In Front"    )
325
326        box = self.layout.box()
327        box.label(text="各操作の初期パラメータ", icon='MATERIAL')
328        row = box.row()  # export
329        row.prop(self, 'custom_normal_blend', icon='SNAP_NORMAL')
330        row.prop(self, 'skip_shapekey', icon='SHAPEKEY_DATA')
331        row.prop(self, 'is_apply_modifiers', icon='MODIFIER')
332        # row = box.row()
333        row = self.layout.row()
334        row.operator('script.update_cm3d2_converter', icon='FILE_REFRESH')
335        row.menu('INFO_MT_help_CM3D2_Converter_RSS', icon='INFO')
336
337        self.layout.operator('cm3d2_converter.dump_py_messages')
338
339
340# プラグインをインストールしたときの処理
341def register():
342    pcoll = bpy.utils.previews.new()
343    dir = os.path.dirname(__file__)
344    pcoll.load('KISS', os.path.join(dir, "kiss.png"), 'IMAGE')
345    common.preview_collections['main'] = pcoll
346    common.bl_info = bl_info
347
348    compat.BlRegister.register()
349    if compat.IS_LEGACY:
350        bpy.types.INFO_MT_file_import.append(model_import.menu_func)
351        bpy.types.INFO_MT_file_import.append(anm_import.menu_func)
352        bpy.types.INFO_MT_file_import.append(menu_file.import_menu_func)
353        bpy.types.INFO_MT_file_export.append(model_export.menu_func)
354        bpy.types.INFO_MT_file_export.append(anm_export.menu_func)
355        bpy.types.INFO_MT_file_export.append(menu_file.export_menu_func)
356
357        bpy.types.INFO_MT_add.append(misc_INFO_MT_add.menu_func)
358        bpy.types.INFO_MT_curve_add.append(misc_INFO_MT_curve_add.menu_func)
359        bpy.types.INFO_MT_help.append(misc_INFO_MT_help.menu_func)
360
361        bpy.types.MATERIAL_PT_context_material.append(misc_MATERIAL_PT_context_material.menu_func)
362        bpy.types.RENDER_PT_bake.append(misc_RENDER_PT_bake.menu_func)
363        bpy.types.RENDER_PT_render.append(misc_RENDER_PT_render.menu_func)
364        bpy.types.TEXTURE_PT_context_texture.append(misc_TEXTURE_PT_context_texture.menu_func)
365        bpy.types.VIEW3D_PT_tools_weightpaint.append(misc_VIEW3D_PT_tools_weightpaint.menu_func)
366
367        # menu
368        bpy.types.DATA_PT_vertex_colors.append(misc_MESH_MT_attribute_context_menu.menu_func)
369        bpy.types.MESH_MT_shape_key_specials.append(misc_MESH_MT_shape_key_specials.menu_func)
370        bpy.types.MESH_MT_vertex_group_specials.append(misc_MESH_MT_vertex_group_specials.menu_func)
371        bpy.types.VIEW3D_MT_edit_mesh_specials.append(misc_VIEW3D_MT_edit_mesh_specials.menu_func)
372        bpy.types.VIEW3D_MT_edit_mesh.append(misc_VIEW3D_MT_edit_mesh_merge.menu_func)
373        bpy.types.VIEW3D_MT_edit_mesh.append(misc_VIEW3D_MT_edit_mesh_split.menu_func)
374    else:
375        bpy.types.TOPBAR_MT_file_import.append(model_import.menu_func)
376        bpy.types.TOPBAR_MT_file_export.append(model_export.menu_func)
377        # anm
378        bpy.types.TOPBAR_MT_file_import.append(anm_import.menu_func)
379        bpy.types.TOPBAR_MT_file_export.append(anm_export.menu_func)
380        # .menu
381        bpy.types.TOPBAR_MT_file_import.append(menu_file.import_menu_func)
382        bpy.types.TOPBAR_MT_file_export.append(menu_file.export_menu_func)
383
384        bpy.types.VIEW3D_MT_add.append(misc_INFO_MT_add.menu_func)
385        bpy.types.VIEW3D_MT_curve_add.append(misc_INFO_MT_curve_add.menu_func)
386        # (更新機能)
387        bpy.types.TOPBAR_MT_help.append(misc_INFO_MT_help.menu_func)
388
389        # マテリアルパネルの追加先がないため、別途Panelを追加
390        # bpy.types.MATERIAL_PT_context_xxx.append(misc_MATERIAL_PT_context_material.menu_func)
391
392        # TODO 修正&動作確認後にコメント解除  (ベイク)
393        # レンダーエンジンがCycles指定時のみになる
394        # bpy.types.CYCLES_RENDER_PT_bake.append(misc_RENDER_PT_bake.menu_func)
395        bpy.types.RENDER_PT_context.append(misc_RENDER_PT_render.menu_func)
396        bpy.types.VIEW3D_PT_tools_weightpaint_options.append(misc_VIEW3D_PT_tools_weightpaint.menu_func)
397
398        # context menu
399        if bpy.app.version < (3,0):
400            bpy.types.DATA_PT_vertex_colors.append(misc_MESH_MT_attribute_context_menu.menu_func)
401        else:
402            bpy.types.MESH_MT_attribute_context_menu.append(misc_MESH_MT_attribute_context_menu.menu_func)
403            bpy.types.MESH_MT_color_attribute_context_menu.append(misc_MESH_MT_attribute_context_menu.menu_func)
404        bpy.types.MESH_MT_shape_key_context_menu.append(misc_MESH_MT_shape_key_specials.menu_func)
405        bpy.types.MESH_MT_vertex_group_context_menu.append(misc_MESH_MT_vertex_group_specials.menu_func)
406        bpy.types.VIEW3D_MT_edit_mesh_context_menu.append(misc_VIEW3D_MT_edit_mesh_specials.menu_func)
407        if bpy.app.version < (2,90):
408            bpy.types.VIEW3D_MT_edit_mesh.append(misc_VIEW3D_MT_edit_mesh_merge.menu_func)
409            bpy.types.VIEW3D_MT_edit_mesh.append(misc_VIEW3D_MT_edit_mesh_split.menu_func)
410        else:
411            bpy.types.VIEW3D_MT_edit_mesh_merge.append(misc_VIEW3D_MT_edit_mesh_merge.menu_func)
412            bpy.types.VIEW3D_MT_edit_mesh_split.append(misc_VIEW3D_MT_edit_mesh_split.menu_func)
413
414    bpy.types.IMAGE_MT_image.append(tex_import.menu_func)
415    bpy.types.IMAGE_MT_image.append(tex_export.menu_func)
416
417    bpy.types.TEXT_MT_text.append(mate_import.TEXT_MT_text)
418    bpy.types.TEXT_MT_text.append(mate_export.TEXT_MT_text)
419
420    bpy.types.DATA_PT_context_arm.append(misc_DATA_PT_context_arm.menu_func)
421    bpy.types.DATA_PT_modifiers.append(misc_DATA_PT_modifiers.menu_func)
422    bpy.types.DATA_PT_vertex_groups.append(misc_DATA_PT_vertex_groups.menu_func)
423    bpy.types.IMAGE_HT_header.append(misc_IMAGE_HT_header.menu_func)
424    bpy.types.IMAGE_PT_image_properties.append(misc_IMAGE_PT_image_properties.menu_func)
425    bpy.types.INFO_HT_header.append(misc_INFO_HT_header.menu_func)
426
427    bpy.types.OBJECT_PT_context_object.append(misc_OBJECT_PT_context_object.menu_func)
428    bpy.types.OBJECT_PT_transform.append(misc_OBJECT_PT_transform.menu_func)
429    bpy.types.TEXT_HT_header.append(misc_TEXT_HT_header.menu_func)
430    bpy.types.VIEW3D_MT_pose_apply.append(misc_VIEW3D_MT_pose_apply.menu_func)
431
432    setattr(bpy.types.Object, 'cm3d2_bone_morph' , bpy.props.PointerProperty(type=misc_DATA_PT_context_arm.CNV_PG_cm3d2_bone_morph ))
433    setattr(bpy.types.Object, 'cm3d2_wide_slider', bpy.props.PointerProperty(type=misc_DATA_PT_context_arm.CNV_PG_cm3d2_wide_slider))
434    setattr(bpy.types.Object, 'cm3d2_menu'       , bpy.props.PointerProperty(type=menu_file.OBJECT_PG_CM3D2Menu                    ))
435    
436    bpy.types.DOPESHEET_MT_editor_menus.append(misc_DOPESHEET_MT_editor_menus.menu_func)
437    bpy.types.GRAPH_MT_editor_menus.append(misc_DOPESHEET_MT_editor_menus.menu_func)
438
439    translations.register(__name__)
440    
441    # Change wiki_url based on locale (only works in legacy version)
442    locale = translations.get_locale()
443    if locale != 'ja_JP':   
444        bl_info['wiki_url'] = common.URL_REPOS + f"blob/bl_28/translations/{locale}/README.md"
445
446
447# プラグインをアンインストールしたときの処理
448def unregister():
449    if compat.IS_LEGACY:
450        bpy.types.INFO_MT_file_import.remove(model_import.menu_func)
451        bpy.types.INFO_MT_file_import.remove(anm_import.menu_func)
452        bpy.types.INFO_MT_file_import.remove(menu_file.import_menu_func)
453        bpy.types.INFO_MT_file_export.remove(model_export.menu_func)
454        bpy.types.INFO_MT_file_export.remove(anm_export.menu_func)
455        bpy.types.INFO_MT_file_export.remove(menu_file.export_menu_func)
456
457        bpy.types.INFO_MT_add.remove(misc_INFO_MT_add.menu_func)
458        bpy.types.INFO_MT_curve_add.remove(misc_INFO_MT_curve_add.menu_func)
459        bpy.types.INFO_MT_help.remove(misc_INFO_MT_help.menu_func)
460
461        bpy.types.MATERIAL_PT_context_material.remove(misc_MATERIAL_PT_context_material.menu_func)
462        bpy.types.RENDER_PT_bake.remove(misc_RENDER_PT_bake.menu_func)
463        bpy.types.RENDER_PT_render.remove(misc_RENDER_PT_render.menu_func)
464        bpy.types.TEXTURE_PT_context_texture.remove(misc_TEXTURE_PT_context_texture.menu_func)
465        bpy.types.VIEW3D_PT_tools_weightpaint.remove(misc_VIEW3D_PT_tools_weightpaint.menu_func)
466
467        # menu
468        bpy.types.DATA_PT_vertex_colors.remove(misc_MESH_MT_attribute_context_menu.menu_func)
469        bpy.types.MESH_MT_shape_key_specials.remove(misc_MESH_MT_shape_key_specials.menu_func)
470        bpy.types.MESH_MT_vertex_group_specials.remove(misc_MESH_MT_vertex_group_specials.menu_func)
471        bpy.types.VIEW3D_MT_edit_mesh_specials.remove(misc_VIEW3D_MT_edit_mesh_specials.menu_func)
472        bpy.types.VIEW3D_MT_edit_mesh.remove(misc_VIEW3D_MT_edit_mesh_merge.menu_func)
473        bpy.types.VIEW3D_MT_edit_mesh.remove(misc_VIEW3D_MT_edit_mesh_split.menu_func)
474    else:
475        bpy.types.TOPBAR_MT_file_import.remove(model_import.menu_func)
476        bpy.types.TOPBAR_MT_file_export.remove(model_export.menu_func)
477        bpy.types.TOPBAR_MT_file_import.remove(anm_import.menu_func)
478        bpy.types.TOPBAR_MT_file_export.remove(anm_export.menu_func)
479        bpy.types.TOPBAR_MT_file_import.remove(menu_file.import_menu_func)
480        bpy.types.TOPBAR_MT_file_export.remove(menu_file.export_menu_func)
481
482        bpy.types.VIEW3D_MT_add.remove(misc_INFO_MT_add.menu_func)
483        bpy.types.VIEW3D_MT_curve_add.remove(misc_INFO_MT_curve_add.menu_func)
484        bpy.types.TOPBAR_MT_help.remove(misc_INFO_MT_help.menu_func)
485
486        # bpy.types.MATERIAL_MT_context_menu.remove(misc_MATERIAL_PT_context_material.menu_func)
487        # bpy.types.CYCLES_RENDER_PT_bake.remove(misc_RENDER_PT_bake.menu_func)
488        bpy.types.RENDER_PT_context.remove(misc_RENDER_PT_render.menu_func)
489
490        bpy.types.VIEW3D_PT_tools_weightpaint_options.remove(misc_VIEW3D_PT_tools_weightpaint.menu_func)
491        # menu
492        if bpy.app.version < (3,0):
493            bpy.types.DATA_PT_vertex_colors.remove(misc_MESH_MT_attribute_context_menu.menu_func)
494        else:
495            bpy.types.MESH_MT_attribute_context_menu.remove(misc_MESH_MT_attribute_context_menu.menu_func)
496            bpy.types.MESH_MT_color_attribute_context_menu.remove(misc_MESH_MT_attribute_context_menu.menu_func)
497        bpy.types.MESH_MT_shape_key_context_menu.remove(misc_MESH_MT_shape_key_specials.menu_func)
498        bpy.types.MESH_MT_vertex_group_context_menu.remove(misc_MESH_MT_vertex_group_specials.menu_func)
499        bpy.types.VIEW3D_MT_edit_mesh_context_menu.remove(misc_VIEW3D_MT_edit_mesh_specials.menu_func)
500        if bpy.app.version < (2,90):
501            bpy.types.VIEW3D_MT_edit_mesh.remove(misc_VIEW3D_MT_edit_mesh_merge.menu_func)
502            bpy.types.VIEW3D_MT_edit_mesh.remove(misc_VIEW3D_MT_edit_mesh_split.menu_func)
503        else:
504            bpy.types.VIEW3D_MT_edit_mesh_merge.remove(misc_VIEW3D_MT_edit_mesh_merge.menu_func)
505            bpy.types.VIEW3D_MT_edit_mesh_split.remove(misc_VIEW3D_MT_edit_mesh_split.menu_func)
506
507    bpy.types.IMAGE_MT_image.remove(tex_import.menu_func)
508    bpy.types.IMAGE_MT_image.remove(tex_export.menu_func)
509
510    bpy.types.TEXT_MT_text.remove(mate_import.TEXT_MT_text)
511    bpy.types.TEXT_MT_text.remove(mate_export.TEXT_MT_text)
512
513    bpy.types.DATA_PT_context_arm.remove(misc_DATA_PT_context_arm.menu_func)
514    bpy.types.DATA_PT_modifiers.remove(misc_DATA_PT_modifiers.menu_func)
515    bpy.types.DATA_PT_vertex_groups.remove(misc_DATA_PT_vertex_groups.menu_func)
516    bpy.types.IMAGE_HT_header.remove(misc_IMAGE_HT_header.menu_func)
517    bpy.types.IMAGE_PT_image_properties.remove(misc_IMAGE_PT_image_properties.menu_func)
518    bpy.types.INFO_HT_header.remove(misc_INFO_HT_header.menu_func)
519
520    bpy.types.OBJECT_PT_context_object.remove(misc_OBJECT_PT_context_object.menu_func)
521    bpy.types.OBJECT_PT_transform.remove(misc_OBJECT_PT_transform.menu_func)
522    bpy.types.TEXT_HT_header.remove(misc_TEXT_HT_header.menu_func)
523    bpy.types.VIEW3D_MT_pose_apply.remove(misc_VIEW3D_MT_pose_apply.menu_func)
524
525    if hasattr(bpy.types.Object, 'cm3d2_bone_morph'):
526        delattr(bpy.types.Object, 'cm3d2_bone_morph')
527    if hasattr(bpy.types.Object, 'cm3d2_wide_slider'):
528        delattr(bpy.types.Object, 'cm3d2_wide_slider')
529    if hasattr(bpy.types.Object, 'cm3d2_menu'):
530        delattr(bpy.types.Object, 'cm3d2_menu')
531
532    bpy.types.DOPESHEET_MT_editor_menus.remove(misc_DOPESHEET_MT_editor_menus.menu_func)
533    bpy.types.GRAPH_MT_editor_menus.remove(misc_DOPESHEET_MT_editor_menus.menu_func)
534
535    for pcoll in common.preview_collections.values():
536        bpy.utils.previews.remove(pcoll)
537    common.preview_collections.clear()
538
539    compat.BlRegister.unregister()
540
541    translations.unregister(__name__)
542
543# メイン関数
544if __name__ == "__main__":
545    register()
bl_info = {'name': 'CM3D2 Converter', 'author': '@saidenka_cm3d2, @trzrz, @luvoid', 'version': ('luv', 2023, 6, '11a'), 'blender': (2, 80, 0), 'location': 'ファイル > インポート/エクスポート > CM3D2 Model (.model)', 'description': 'カスタムメイド3D2/カスタムオーダーメイド3D2専用ファイルのインポート/エクスポートを行います', 'warning': '', 'wiki_url': 'https://github.com/luvoid/Blender-CM3D2-Converter/blob/bl_28/translations/en_US/README.md', 'tracker_url': 'https://github.com/luvoid/Blender-CM3D2-Converter', 'category': 'Import-Export'}
@compat.BlRegister()
class AddonPreferences(bpy_types.AddonPreferences):
129@compat.BlRegister()
130class AddonPreferences(bpy.types.AddonPreferences):
131    bl_idname = __name__
132
133    cm3d2_path = bpy.props.StringProperty(name="CM3D2インストールフォルダ", subtype='DIR_PATH', description="変更している場合は設定しておくと役立つかもしれません")
134    backup_ext = bpy.props.StringProperty(name="バックアップの拡張子 (空欄で無効)", description="エクスポート時にバックアップを作成時この拡張子で複製します、空欄でバックアップを無効", default='bak')
135
136    scale = bpy.props.FloatProperty(name="倍率", description="Blenderでモデルを扱うときの拡大率", default=5, min=0.01, max=100, soft_min=0.01, soft_max=100, step=10, precision=2)
137    is_convert_bone_weight_names = bpy.props.BoolProperty(name="基本的にボーン名/ウェイト名をBlender用に変換", default=False, description="modelインポート時にボーン名/ウェイト名を変換するかどうかのオプションのデフォルトを設定します")
138    model_default_path = bpy.props.StringProperty(name="modelファイル置き場", subtype='DIR_PATH', description="設定すれば、modelを扱う時は必ずここからファイル選択を始めます")
139    model_import_path = bpy.props.StringProperty(name="modelインポート時のデフォルトパス", subtype='FILE_PATH', description="modelインポート時に最初はここが表示されます、インポート毎に保存されます")
140    model_export_path = bpy.props.StringProperty(name="modelエクスポート時のデフォルトパス", subtype='FILE_PATH', description="modelエクスポート時に最初はここが表示されます、エクスポート毎に保存されます")
141
142    anm_default_path = bpy.props.StringProperty(name="anmファイル置き場", subtype='DIR_PATH', description="設定すれば、anmを扱う時は必ずここからファイル選択を始めます")
143    anm_import_path = bpy.props.StringProperty(name="anmインポート時のデフォルトパス", subtype='FILE_PATH', description="anmインポート時に最初はここが表示されます、インポート毎に保存されます")
144    anm_export_path = bpy.props.StringProperty(name="anmエクスポート時のデフォルトパス", subtype='FILE_PATH', description="anmエクスポート時に最初はここが表示されます、エクスポート毎に保存されます")
145
146    tex_default_path = bpy.props.StringProperty(name="texファイル置き場", subtype='DIR_PATH', description="設定すれば、texを扱う時は必ずここからファイル選択を始めます")
147    tex_import_path = bpy.props.StringProperty(name="texインポート時のデフォルトパス", subtype='FILE_PATH', description="texインポート時に最初はここが表示されます、インポート毎に保存されます")
148    tex_export_path = bpy.props.StringProperty(name="texエクスポート時のデフォルトパス", subtype='FILE_PATH', description="texエクスポート時に最初はここが表示されます、エクスポート毎に保存されます")
149
150    mate_default_path = bpy.props.StringProperty(name="mateファイル置き場", subtype='DIR_PATH', description="設定すれば、mateを扱う時は必ずここからファイル選択を始めます")
151    mate_unread_same_value = bpy.props.BoolProperty(name="同じ設定値が2つ以上ある場合削除", default=True, description="_ShadowColor など")
152    mate_import_path = bpy.props.StringProperty(name="mateインポート時のデフォルトパス", subtype='FILE_PATH', description="mateインポート時に最初はここが表示されます、インポート毎に保存されます")
153    mate_export_path = bpy.props.StringProperty(name="mateエクスポート時のデフォルトパス", subtype='FILE_PATH', description="mateエクスポート時に最初はここが表示されます、エクスポート毎に保存されます")
154    
155    menu_default_path = bpy.props.StringProperty(name=".menu Default Path"       , subtype='DIR_PATH' , description="If set. The file selection will open here.")
156    menu_import_path  = bpy.props.StringProperty(name=".menu Default Import Path", subtype='FILE_PATH', description="When importing a .menu file. The file selection prompt will begin here.")
157    menu_export_path  = bpy.props.StringProperty(name=".menu Default Export Path", subtype='FILE_PATH', description="When exporting a .menu file. The file selection prompt will begin here.")
158    
159    is_replace_cm3d2_tex = bpy.props.BoolProperty(name="基本的にtexファイルを探す", default=True, description="texファイルを探すかどうかのオプションのデフォルト値を設定します")
160    default_tex_path0 = bpy.props.StringProperty(name="texファイル置き場", subtype='DIR_PATH', description="texファイルを探す時はここから探します")
161    default_tex_path1 = bpy.props.StringProperty(name="texファイル置き場", subtype='DIR_PATH', description="texファイルを探す時はここから探します")
162    default_tex_path2 = bpy.props.StringProperty(name="texファイル置き場", subtype='DIR_PATH', description="texファイルを探す時はここから探します")
163    default_tex_path3 = bpy.props.StringProperty(name="texファイル置き場", subtype='DIR_PATH', description="texファイルを探す時はここから探します")
164
165    custom_normal_blend = bpy.props.FloatProperty(name="CM3D2用法線のブレンド率", default=0.5, min=0, max=1, soft_min=0, soft_max=1, step=3, precision=3)
166    skip_shapekey = bpy.props.BoolProperty(name="無変更シェイプキーをスキップ", default=True, description="ベースと同じシェイプキーを出力しない")
167    is_apply_modifiers = bpy.props.BoolProperty(name="モディファイアを適用", default=False)
168
169    new_mate_tex_offset = bpy.props.FloatVectorProperty(name="テクスチャのオフセット", default=(0, 0), min=-1, max=1, soft_min=-1, soft_max=1, step=10, precision=3, size=2)
170    new_mate_tex_scale = bpy.props.FloatVectorProperty(name="テクスチャのスケール", default=(1, 1), min=0, max=1, soft_min=0, soft_max=1, step=10, precision=3, size=2)
171
172    new_mate_toonramp_name = bpy.props.StringProperty(name="_ToonRamp 名前", default="toonGrayA1")
173    new_mate_toonramp_path = bpy.props.StringProperty(name="_ToonRamp パス", default=common.BASE_PATH_TEX + "toon/toonGrayA1.png")
174
175    new_mate_shadowratetoon_name = bpy.props.StringProperty(name="_ShadowRateToon 名前", default="toonDress_shadow")
176    new_mate_shadowratetoon_path = bpy.props.StringProperty(name="_ShadowRateToon パス", default=common.BASE_PATH_TEX + "toon/toonDress_shadow.png")
177
178    new_mate_linetoonramp_name = bpy.props.StringProperty(name="_OutlineToonRamp 名前", default="toonGrayA1")
179    new_mate_linetoonramp_path = bpy.props.StringProperty(name="_OutlineToonRamp パス", default=common.BASE_PATH_TEX + "toon/toonGrayA1.png")
180
181    new_mate_color = bpy.props.FloatVectorProperty(name="_Color", default=(1, 1, 1, 1), min=0, max=1, soft_min=0, soft_max=1, step=10, precision=2, subtype='COLOR', size=4)
182    new_mate_shadowcolor = bpy.props.FloatVectorProperty(name="_ShadowColor", default=(0, 0, 0, 1), min=0, max=1, soft_min=0, soft_max=1, step=10, precision=2, subtype='COLOR', size=4)
183    new_mate_rimcolor = bpy.props.FloatVectorProperty(name="_RimColor", default=(0.5, 0.5, 0.5, 1), min=0, max=1, soft_min=0, soft_max=1, step=10, precision=2, subtype='COLOR', size=4)
184    new_mate_outlinecolor = bpy.props.FloatVectorProperty(name="_OutlineColor", default=(0, 0, 0, 1), min=0, max=1, soft_min=0, soft_max=1, step=10, precision=2, subtype='COLOR', size=4)
185
186    new_mate_shininess  = bpy.props.FloatProperty(name="_Shininess", default=0, min=-100, max=100, soft_min=-100, soft_max=100, step=1, precision=2)
187    new_mate_outlinewidth = bpy.props.FloatProperty(name="_OutlineWidth", default=0.0015, min=-100, max=100, soft_min=-100, soft_max=100, step=1, precision=2)
188    new_mate_rimpower = bpy.props.FloatProperty(name="_RimPower", default=25, min=-100, max=100, soft_min=-100, soft_max=100, step=1, precision=2)
189    new_mate_rimshift = bpy.props.FloatProperty(name="_RimShift", default=0, min=-100, max=100, soft_min=-100, soft_max=100, step=1, precision=2)
190    new_mate_hirate = bpy.props.FloatProperty(name="_HiRate", default=0.5, min=-100, max=100, soft_min=-100, soft_max=100, step=1, precision=2)
191    new_mate_hipow = bpy.props.FloatProperty(name="_HiPow", default=0.001, min=-100, max=100, soft_min=-100, soft_max=100, step=1, precision=2)
192    new_mate_cutoff = bpy.props.FloatProperty(name="_Cutoff", default=0.5, min=0, max=1, soft_min=0, soft_max=1, step=10, precision=2)
193    new_mate_cutout = bpy.props.FloatProperty(name="_Cutout", default=0.482143, min=0, max=1, soft_min=0, soft_max=1, step=10, precision=6)
194    new_mate_ztest = bpy.props.FloatProperty(name="_ZTest", default=4, min=0, max=8, soft_min=0, soft_max=8, step=1)
195    new_mate_ztest2 = bpy.props.FloatProperty(name="_ZTest2", default=1, min=0, max=1, soft_min=0, soft_max=1, step=1)
196    new_mate_ztest2alpha = bpy.props.FloatProperty(name="_ZTest2Alpha", default=0.8, min=0, max=1, soft_min=0, soft_max=1, step=1, precision=2)
197
198    bone_display_type = bpy.props.EnumProperty(
199        items=[
200            ('OCTAHEDRAL', "Octahedral", "Display bones as octahedral shape (default)."                            ),
201            ('STICK'     , "Stick"     , "Display bones as simple 2D lines with dots."                             ),
202            ('BBONE'     , "B-Bone"    , "Display bones as boxes, showing subdivision and B-Splines."              ),
203            ('ENVELOPE'  , "Envelope"  , "Display bones as extruded spheres, showing deformation influence volume."),
204            ('WIRE'      , "Wire"      , "Display bones as thin wires, showing subdivision and B-Splines."         ),
205        ],
206        name="Display Type",
207        default='STICK',
208    )
209    show_bone_names         = bpy.props.BoolProperty(name="Show Bone Names"       , default=False, description="Display bone names"                     )
210    show_bone_axes          = bpy.props.BoolProperty(name="Show Bone Axes"        , default=False, description="Display bone axes"                      )
211    show_bone_custom_shapes = bpy.props.BoolProperty(name="Show Bone Shapes"      , default=True , description="Display bones with their custom shapes" )
212    show_bone_group_colors  = bpy.props.BoolProperty(name="Show Bone Group Colors", default=True , description="Display bone group colors"              )
213    show_bone_in_front      = bpy.props.BoolProperty(name="Show Bones in Front"   , default=True , description="Make the object draw in front of others")
214
215    def draw(self, context):
216        if compat.IS_LEGACY:
217            self.layout.label(text="ここの設定は「ユーザー設定の保存」ボタンを押すまで保存されていません", icon='QUESTION')
218        else:
219            self.layout.label(text="設定値を変更した場合、「プリファレンスを保存」ボタンを押下するか、「プリファレンスを自動保存」を有効にして保存してください", icon='QUESTION')
220        
221        col = self.layout.column()
222        col.label(text="CM3D2 Converter Info")
223        factor = 0.25
224        split = compat.layout_split(col.row(), factor)
225        split.label(text="Add-on Version: ")
226        split.label(text=".".join(str(i) for i in bl_info["version"]))
227        split = compat.layout_split(col.row(), factor)
228        split.label(text="Branch: ")
229        split.label(text=common.BRANCH)
230        split = compat.layout_split(col.row(), factor)
231        split.label(text="Repo URL: ")
232        split.label(text=common.URL_REPOS)
233        split = compat.layout_split(col.row(), factor)
234        split.label(text="Blender Version: ")
235        split.label(text=".".join(str(i) for i in bpy.app.version) if hasattr(bpy.app, 'version') else "Legacy")
236        split = compat.layout_split(col.row(), factor)
237        split.label(text="Blender Language: ")
238        split.label(text=compat.get_system(bpy.context).language or 'None')
239        default_locale = 'UNKNOWN'
240        try:
241            import locale
242            default_locale = locale.getdefaultlocale()[0]
243        except:
244            pass
245        split = compat.layout_split(col.row(), factor)
246        split.label(text="Default Language: ")
247        split.label(text=default_locale)
248
249        self.layout.label(text="."*9999)
250        self.layout.label(text="Preferences:")
251
252        self.layout.prop(self, 'cm3d2_path', icon_value=common.kiss_icon())
253        self.layout.prop(self, 'backup_ext', icon='FILE_BACKUP')
254
255        box = self.layout.box()
256        box.label(text="modelファイル", icon='MESH_ICOSPHERE')
257        row = box.row()
258        row.prop(self, 'scale', icon=compat.icon('ARROW_LEFTRIGHT'))
259        row.prop(self, 'is_convert_bone_weight_names', icon='BLENDER')
260        brws_icon = compat.icon('FILEBROWSER')
261        box.prop(self, 'model_default_path', icon=brws_icon, text="ファイル選択時の初期フォルダ")
262
263        box = self.layout.box()
264        box.label(text="anmファイル", icon='POSE_HLT')
265        box.prop(self, 'anm_default_path', icon=brws_icon, text="ファイル選択時の初期フォルダ")
266
267        box = self.layout.box()
268        box.label(text="texファイル", icon='FILE_IMAGE')
269        box.prop(self, 'tex_default_path', icon=brws_icon, text="ファイル選択時の初期フォルダ")
270
271        box = self.layout.box()
272        box.label(text="mateファイル", icon='MATERIAL')
273        box.prop(self, 'mate_unread_same_value', icon='DISCLOSURE_TRI_DOWN')
274        box.prop(self, 'mate_default_path', icon=brws_icon, text="ファイル選択時の初期フォルダ")
275
276        box = self.layout.box()
277        box.label(text=".menu File", icon='COPY_ID')
278        box.prop(self, 'menu_default_path', icon=brws_icon, text="Initial folder when selecting files")
279
280        box = self.layout.box()
281        box.label(text="texファイル検索", icon='BORDERMOVE')
282        box.prop(self, 'is_replace_cm3d2_tex', icon='VIEWZOOM')
283        box.prop(self, 'default_tex_path0', icon='LAYER_ACTIVE', text="その1")
284        box.prop(self, 'default_tex_path1', icon='LAYER_ACTIVE', text="その2")
285        box.prop(self, 'default_tex_path2', icon='LAYER_ACTIVE', text="その3")
286        box.prop(self, 'default_tex_path3', icon='LAYER_ACTIVE', text="その4")
287
288        box = self.layout.box()
289        box.label(text="CM3D2用マテリアル新規作成時の初期値", icon='MATERIAL')
290        row = box.row()
291        row.prop(self, 'new_mate_tex_offset', icon='MOD_MULTIRES')
292        row.prop(self, 'new_mate_tex_scale', icon='ARROW_LEFTRIGHT')
293        row = box.row()
294        row.prop(self, 'new_mate_toonramp_name', icon='BRUSH_TEXFILL')
295        row.prop(self, 'new_mate_toonramp_path', icon='ANIM')
296        row = box.row()
297        row.prop(self, 'new_mate_shadowratetoon_name', icon='BRUSH_TEXMASK')
298        row.prop(self, 'new_mate_shadowratetoon_path', icon='ANIM')
299        row = box.row()
300        row.prop(self, 'new_mate_color', icon='COLOR')
301        row.prop(self, 'new_mate_shadowcolor', icon='IMAGE_ALPHA')
302        row.prop(self, 'new_mate_rimcolor', icon=compat.icon('SHADING_RENDERED'))
303        row.prop(self, 'new_mate_outlinecolor', icon=compat.icon('SHADING_SOLID'))
304        row = box.row()
305        row.prop(self, 'new_mate_shininess', icon=compat.icon('NODE_MATERIAL'))
306        row.prop(self, 'new_mate_outlinewidth', icon=compat.icon('SHADING_SOLID'))
307        row.prop(self, 'new_mate_rimpower', icon=compat.icon('SHADING_RENDERED'))
308        row.prop(self, 'new_mate_rimshift', icon='ARROW_LEFTRIGHT')
309        row.prop(self, 'new_mate_hirate')
310        row.prop(self, 'new_mate_hipow')
311
312        box = self.layout.box()
313        box.label(text="Default Armature Settings", icon='ARMATURE_DATA')
314        if not compat.IS_LEGACY:
315            box.use_property_split = True
316        box.prop(self, "bone_display_type", text="Display As")
317        if compat.IS_LEGACY:
318            flow = box.column_flow(align=True)
319        else:
320            flow = box.grid_flow(align=True)
321        col = flow.column(); col.prop(self, "show_bone_names",         text="Names"       )
322        col = flow.column(); col.prop(self, "show_bone_axes",          text="Axes"        )
323        col = flow.column(); col.prop(self, "show_bone_custom_shapes", text="Shapes"      )
324        col = flow.column(); col.prop(self, "show_bone_group_colors",  text="Group Colors")
325        col = flow.column(); col.prop(self, "show_bone_in_front",      text="In Front"    )
326
327        box = self.layout.box()
328        box.label(text="各操作の初期パラメータ", icon='MATERIAL')
329        row = box.row()  # export
330        row.prop(self, 'custom_normal_blend', icon='SNAP_NORMAL')
331        row.prop(self, 'skip_shapekey', icon='SHAPEKEY_DATA')
332        row.prop(self, 'is_apply_modifiers', icon='MODIFIER')
333        # row = box.row()
334        row = self.layout.row()
335        row.operator('script.update_cm3d2_converter', icon='FILE_REFRESH')
336        row.menu('INFO_MT_help_CM3D2_Converter_RSS', icon='INFO')
337
338        self.layout.operator('cm3d2_converter.dump_py_messages')
bl_idname = 'CM3D2 Converter'
cm3d2_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'CM3D2インストールフォルダ', 'subtype': 'DIR_PATH', 'description': '変更している場合は設定しておくと役立つかもしれません', 'attr': 'cm3d2_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'CM3D2インストールフォルダ', 'subtype': 'DIR_PATH', 'description': '変更している場合は設定しておくと役立つかもしれません', 'attr': 'cm3d2_path'}>
backup_ext: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'バックアップの拡張子 (空欄で無効)', 'description': 'エクスポート時にバックアップを作成時この拡張子で複製します、空欄でバックアップを無効', 'default': 'bak', 'attr': 'backup_ext'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'バックアップの拡張子 (空欄で無効)', 'description': 'エクスポート時にバックアップを作成時この拡張子で複製します、空欄でバックアップを無効', 'default': 'bak', 'attr': 'backup_ext'}>
scale: <_PropertyDeferred, <built-in function FloatProperty>, {'name': '倍率', 'description': 'Blenderでモデルを扱うときの拡大率', 'default': 5, 'min': 0.01, 'max': 100, 'soft_min': 0.01, 'soft_max': 100, 'step': 10, 'precision': 2, 'attr': 'scale'}> = <_PropertyDeferred, <built-in function FloatProperty>, {'name': '倍率', 'description': 'Blenderでモデルを扱うときの拡大率', 'default': 5, 'min': 0.01, 'max': 100, 'soft_min': 0.01, 'soft_max': 100, 'step': 10, 'precision': 2, 'attr': 'scale'}>
is_convert_bone_weight_names: <_PropertyDeferred, <built-in function BoolProperty>, {'name': '基本的にボーン名/ウェイト名をBlender用に変換', 'default': False, 'description': 'modelインポート時にボーン名/ウェイト名を変換するかどうかのオプションのデフォルトを設定します', 'attr': 'is_convert_bone_weight_names'}> = <_PropertyDeferred, <built-in function BoolProperty>, {'name': '基本的にボーン名/ウェイト名をBlender用に変換', 'default': False, 'description': 'modelインポート時にボーン名/ウェイト名を変換するかどうかのオプションのデフォルトを設定します', 'attr': 'is_convert_bone_weight_names'}>
model_default_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'modelファイル置き場', 'subtype': 'DIR_PATH', 'description': '設定すれば、modelを扱う時は必ずここからファイル選択を始めます', 'attr': 'model_default_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'modelファイル置き場', 'subtype': 'DIR_PATH', 'description': '設定すれば、modelを扱う時は必ずここからファイル選択を始めます', 'attr': 'model_default_path'}>
model_import_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'modelインポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'modelインポート時に最初はここが表示されます、インポート毎に保存されます', 'attr': 'model_import_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'modelインポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'modelインポート時に最初はここが表示されます、インポート毎に保存されます', 'attr': 'model_import_path'}>
model_export_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'modelエクスポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'modelエクスポート時に最初はここが表示されます、エクスポート毎に保存されます', 'attr': 'model_export_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'modelエクスポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'modelエクスポート時に最初はここが表示されます、エクスポート毎に保存されます', 'attr': 'model_export_path'}>
anm_default_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'anmファイル置き場', 'subtype': 'DIR_PATH', 'description': '設定すれば、anmを扱う時は必ずここからファイル選択を始めます', 'attr': 'anm_default_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'anmファイル置き場', 'subtype': 'DIR_PATH', 'description': '設定すれば、anmを扱う時は必ずここからファイル選択を始めます', 'attr': 'anm_default_path'}>
anm_import_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'anmインポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'anmインポート時に最初はここが表示されます、インポート毎に保存されます', 'attr': 'anm_import_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'anmインポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'anmインポート時に最初はここが表示されます、インポート毎に保存されます', 'attr': 'anm_import_path'}>
anm_export_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'anmエクスポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'anmエクスポート時に最初はここが表示されます、エクスポート毎に保存されます', 'attr': 'anm_export_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'anmエクスポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'anmエクスポート時に最初はここが表示されます、エクスポート毎に保存されます', 'attr': 'anm_export_path'}>
tex_default_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'texファイル置き場', 'subtype': 'DIR_PATH', 'description': '設定すれば、texを扱う時は必ずここからファイル選択を始めます', 'attr': 'tex_default_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'texファイル置き場', 'subtype': 'DIR_PATH', 'description': '設定すれば、texを扱う時は必ずここからファイル選択を始めます', 'attr': 'tex_default_path'}>
tex_import_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'texインポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'texインポート時に最初はここが表示されます、インポート毎に保存されます', 'attr': 'tex_import_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'texインポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'texインポート時に最初はここが表示されます、インポート毎に保存されます', 'attr': 'tex_import_path'}>
tex_export_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'texエクスポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'texエクスポート時に最初はここが表示されます、エクスポート毎に保存されます', 'attr': 'tex_export_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'texエクスポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'texエクスポート時に最初はここが表示されます、エクスポート毎に保存されます', 'attr': 'tex_export_path'}>
mate_default_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'mateファイル置き場', 'subtype': 'DIR_PATH', 'description': '設定すれば、mateを扱う時は必ずここからファイル選択を始めます', 'attr': 'mate_default_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'mateファイル置き場', 'subtype': 'DIR_PATH', 'description': '設定すれば、mateを扱う時は必ずここからファイル選択を始めます', 'attr': 'mate_default_path'}>
mate_unread_same_value: <_PropertyDeferred, <built-in function BoolProperty>, {'name': '同じ設定値が2つ以上ある場合削除', 'default': True, 'description': '_ShadowColor など', 'attr': 'mate_unread_same_value'}> = <_PropertyDeferred, <built-in function BoolProperty>, {'name': '同じ設定値が2つ以上ある場合削除', 'default': True, 'description': '_ShadowColor など', 'attr': 'mate_unread_same_value'}>
mate_import_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'mateインポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'mateインポート時に最初はここが表示されます、インポート毎に保存されます', 'attr': 'mate_import_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'mateインポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'mateインポート時に最初はここが表示されます、インポート毎に保存されます', 'attr': 'mate_import_path'}>
mate_export_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'mateエクスポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'mateエクスポート時に最初はここが表示されます、エクスポート毎に保存されます', 'attr': 'mate_export_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'mateエクスポート時のデフォルトパス', 'subtype': 'FILE_PATH', 'description': 'mateエクスポート時に最初はここが表示されます、エクスポート毎に保存されます', 'attr': 'mate_export_path'}>
menu_default_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': '.menu Default Path', 'subtype': 'DIR_PATH', 'description': 'If set. The file selection will open here.', 'attr': 'menu_default_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': '.menu Default Path', 'subtype': 'DIR_PATH', 'description': 'If set. The file selection will open here.', 'attr': 'menu_default_path'}>
menu_import_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': '.menu Default Import Path', 'subtype': 'FILE_PATH', 'description': 'When importing a .menu file. The file selection prompt will begin here.', 'attr': 'menu_import_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': '.menu Default Import Path', 'subtype': 'FILE_PATH', 'description': 'When importing a .menu file. The file selection prompt will begin here.', 'attr': 'menu_import_path'}>
menu_export_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': '.menu Default Export Path', 'subtype': 'FILE_PATH', 'description': 'When exporting a .menu file. The file selection prompt will begin here.', 'attr': 'menu_export_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': '.menu Default Export Path', 'subtype': 'FILE_PATH', 'description': 'When exporting a .menu file. The file selection prompt will begin here.', 'attr': 'menu_export_path'}>
is_replace_cm3d2_tex: <_PropertyDeferred, <built-in function BoolProperty>, {'name': '基本的にtexファイルを探す', 'default': True, 'description': 'texファイルを探すかどうかのオプションのデフォルト値を設定します', 'attr': 'is_replace_cm3d2_tex'}> = <_PropertyDeferred, <built-in function BoolProperty>, {'name': '基本的にtexファイルを探す', 'default': True, 'description': 'texファイルを探すかどうかのオプションのデフォルト値を設定します', 'attr': 'is_replace_cm3d2_tex'}>
default_tex_path0: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'texファイル置き場', 'subtype': 'DIR_PATH', 'description': 'texファイルを探す時はここから探します', 'attr': 'default_tex_path0'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'texファイル置き場', 'subtype': 'DIR_PATH', 'description': 'texファイルを探す時はここから探します', 'attr': 'default_tex_path0'}>
default_tex_path1: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'texファイル置き場', 'subtype': 'DIR_PATH', 'description': 'texファイルを探す時はここから探します', 'attr': 'default_tex_path1'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'texファイル置き場', 'subtype': 'DIR_PATH', 'description': 'texファイルを探す時はここから探します', 'attr': 'default_tex_path1'}>
default_tex_path2: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'texファイル置き場', 'subtype': 'DIR_PATH', 'description': 'texファイルを探す時はここから探します', 'attr': 'default_tex_path2'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'texファイル置き場', 'subtype': 'DIR_PATH', 'description': 'texファイルを探す時はここから探します', 'attr': 'default_tex_path2'}>
default_tex_path3: <_PropertyDeferred, <built-in function StringProperty>, {'name': 'texファイル置き場', 'subtype': 'DIR_PATH', 'description': 'texファイルを探す時はここから探します', 'attr': 'default_tex_path3'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': 'texファイル置き場', 'subtype': 'DIR_PATH', 'description': 'texファイルを探す時はここから探します', 'attr': 'default_tex_path3'}>
custom_normal_blend: <_PropertyDeferred, <built-in function FloatProperty>, {'name': 'CM3D2用法線のブレンド率', 'default': 0.5, 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 3, 'precision': 3, 'attr': 'custom_normal_blend'}> = <_PropertyDeferred, <built-in function FloatProperty>, {'name': 'CM3D2用法線のブレンド率', 'default': 0.5, 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 3, 'precision': 3, 'attr': 'custom_normal_blend'}>
skip_shapekey: <_PropertyDeferred, <built-in function BoolProperty>, {'name': '無変更シェイプキーをスキップ', 'default': True, 'description': 'ベースと同じシェイプキーを出力しない', 'attr': 'skip_shapekey'}> = <_PropertyDeferred, <built-in function BoolProperty>, {'name': '無変更シェイプキーをスキップ', 'default': True, 'description': 'ベースと同じシェイプキーを出力しない', 'attr': 'skip_shapekey'}>
is_apply_modifiers: <_PropertyDeferred, <built-in function BoolProperty>, {'name': 'モディファイアを適用', 'default': False, 'attr': 'is_apply_modifiers'}> = <_PropertyDeferred, <built-in function BoolProperty>, {'name': 'モディファイアを適用', 'default': False, 'attr': 'is_apply_modifiers'}>
new_mate_tex_offset: <_PropertyDeferred, <built-in function FloatVectorProperty>, {'name': 'テクスチャのオフセット', 'default': (0, 0), 'min': -1, 'max': 1, 'soft_min': -1, 'soft_max': 1, 'step': 10, 'precision': 3, 'size': 2, 'attr': 'new_mate_tex_offset'}> = <_PropertyDeferred, <built-in function FloatVectorProperty>, {'name': 'テクスチャのオフセット', 'default': (0, 0), 'min': -1, 'max': 1, 'soft_min': -1, 'soft_max': 1, 'step': 10, 'precision': 3, 'size': 2, 'attr': 'new_mate_tex_offset'}>
new_mate_tex_scale: <_PropertyDeferred, <built-in function FloatVectorProperty>, {'name': 'テクスチャのスケール', 'default': (1, 1), 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 10, 'precision': 3, 'size': 2, 'attr': 'new_mate_tex_scale'}> = <_PropertyDeferred, <built-in function FloatVectorProperty>, {'name': 'テクスチャのスケール', 'default': (1, 1), 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 10, 'precision': 3, 'size': 2, 'attr': 'new_mate_tex_scale'}>
new_mate_toonramp_name: <_PropertyDeferred, <built-in function StringProperty>, {'name': '_ToonRamp 名前', 'default': 'toonGrayA1', 'attr': 'new_mate_toonramp_name'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': '_ToonRamp 名前', 'default': 'toonGrayA1', 'attr': 'new_mate_toonramp_name'}>
new_mate_toonramp_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': '_ToonRamp パス', 'default': 'Assets/texture/texture/toon/toonGrayA1.png', 'attr': 'new_mate_toonramp_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': '_ToonRamp パス', 'default': 'Assets/texture/texture/toon/toonGrayA1.png', 'attr': 'new_mate_toonramp_path'}>
new_mate_shadowratetoon_name: <_PropertyDeferred, <built-in function StringProperty>, {'name': '_ShadowRateToon 名前', 'default': 'toonDress_shadow', 'attr': 'new_mate_shadowratetoon_name'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': '_ShadowRateToon 名前', 'default': 'toonDress_shadow', 'attr': 'new_mate_shadowratetoon_name'}>
new_mate_shadowratetoon_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': '_ShadowRateToon パス', 'default': 'Assets/texture/texture/toon/toonDress_shadow.png', 'attr': 'new_mate_shadowratetoon_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': '_ShadowRateToon パス', 'default': 'Assets/texture/texture/toon/toonDress_shadow.png', 'attr': 'new_mate_shadowratetoon_path'}>
new_mate_linetoonramp_name: <_PropertyDeferred, <built-in function StringProperty>, {'name': '_OutlineToonRamp 名前', 'default': 'toonGrayA1', 'attr': 'new_mate_linetoonramp_name'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': '_OutlineToonRamp 名前', 'default': 'toonGrayA1', 'attr': 'new_mate_linetoonramp_name'}>
new_mate_linetoonramp_path: <_PropertyDeferred, <built-in function StringProperty>, {'name': '_OutlineToonRamp パス', 'default': 'Assets/texture/texture/toon/toonGrayA1.png', 'attr': 'new_mate_linetoonramp_path'}> = <_PropertyDeferred, <built-in function StringProperty>, {'name': '_OutlineToonRamp パス', 'default': 'Assets/texture/texture/toon/toonGrayA1.png', 'attr': 'new_mate_linetoonramp_path'}>
new_mate_color: <_PropertyDeferred, <built-in function FloatVectorProperty>, {'name': '_Color', 'default': (1, 1, 1, 1), 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 10, 'precision': 2, 'subtype': 'COLOR', 'size': 4, 'attr': 'new_mate_color'}> = <_PropertyDeferred, <built-in function FloatVectorProperty>, {'name': '_Color', 'default': (1, 1, 1, 1), 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 10, 'precision': 2, 'subtype': 'COLOR', 'size': 4, 'attr': 'new_mate_color'}>
new_mate_shadowcolor: <_PropertyDeferred, <built-in function FloatVectorProperty>, {'name': '_ShadowColor', 'default': (0, 0, 0, 1), 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 10, 'precision': 2, 'subtype': 'COLOR', 'size': 4, 'attr': 'new_mate_shadowcolor'}> = <_PropertyDeferred, <built-in function FloatVectorProperty>, {'name': '_ShadowColor', 'default': (0, 0, 0, 1), 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 10, 'precision': 2, 'subtype': 'COLOR', 'size': 4, 'attr': 'new_mate_shadowcolor'}>
new_mate_rimcolor: <_PropertyDeferred, <built-in function FloatVectorProperty>, {'name': '_RimColor', 'default': (0.5, 0.5, 0.5, 1), 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 10, 'precision': 2, 'subtype': 'COLOR', 'size': 4, 'attr': 'new_mate_rimcolor'}> = <_PropertyDeferred, <built-in function FloatVectorProperty>, {'name': '_RimColor', 'default': (0.5, 0.5, 0.5, 1), 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 10, 'precision': 2, 'subtype': 'COLOR', 'size': 4, 'attr': 'new_mate_rimcolor'}>
new_mate_outlinecolor: <_PropertyDeferred, <built-in function FloatVectorProperty>, {'name': '_OutlineColor', 'default': (0, 0, 0, 1), 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 10, 'precision': 2, 'subtype': 'COLOR', 'size': 4, 'attr': 'new_mate_outlinecolor'}> = <_PropertyDeferred, <built-in function FloatVectorProperty>, {'name': '_OutlineColor', 'default': (0, 0, 0, 1), 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 10, 'precision': 2, 'subtype': 'COLOR', 'size': 4, 'attr': 'new_mate_outlinecolor'}>
new_mate_shininess: <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_Shininess', 'default': 0, 'min': -100, 'max': 100, 'soft_min': -100, 'soft_max': 100, 'step': 1, 'precision': 2, 'attr': 'new_mate_shininess'}> = <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_Shininess', 'default': 0, 'min': -100, 'max': 100, 'soft_min': -100, 'soft_max': 100, 'step': 1, 'precision': 2, 'attr': 'new_mate_shininess'}>
new_mate_outlinewidth: <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_OutlineWidth', 'default': 0.0015, 'min': -100, 'max': 100, 'soft_min': -100, 'soft_max': 100, 'step': 1, 'precision': 2, 'attr': 'new_mate_outlinewidth'}> = <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_OutlineWidth', 'default': 0.0015, 'min': -100, 'max': 100, 'soft_min': -100, 'soft_max': 100, 'step': 1, 'precision': 2, 'attr': 'new_mate_outlinewidth'}>
new_mate_rimpower: <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_RimPower', 'default': 25, 'min': -100, 'max': 100, 'soft_min': -100, 'soft_max': 100, 'step': 1, 'precision': 2, 'attr': 'new_mate_rimpower'}> = <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_RimPower', 'default': 25, 'min': -100, 'max': 100, 'soft_min': -100, 'soft_max': 100, 'step': 1, 'precision': 2, 'attr': 'new_mate_rimpower'}>
new_mate_rimshift: <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_RimShift', 'default': 0, 'min': -100, 'max': 100, 'soft_min': -100, 'soft_max': 100, 'step': 1, 'precision': 2, 'attr': 'new_mate_rimshift'}> = <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_RimShift', 'default': 0, 'min': -100, 'max': 100, 'soft_min': -100, 'soft_max': 100, 'step': 1, 'precision': 2, 'attr': 'new_mate_rimshift'}>
new_mate_hirate: <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_HiRate', 'default': 0.5, 'min': -100, 'max': 100, 'soft_min': -100, 'soft_max': 100, 'step': 1, 'precision': 2, 'attr': 'new_mate_hirate'}> = <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_HiRate', 'default': 0.5, 'min': -100, 'max': 100, 'soft_min': -100, 'soft_max': 100, 'step': 1, 'precision': 2, 'attr': 'new_mate_hirate'}>
new_mate_hipow: <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_HiPow', 'default': 0.001, 'min': -100, 'max': 100, 'soft_min': -100, 'soft_max': 100, 'step': 1, 'precision': 2, 'attr': 'new_mate_hipow'}> = <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_HiPow', 'default': 0.001, 'min': -100, 'max': 100, 'soft_min': -100, 'soft_max': 100, 'step': 1, 'precision': 2, 'attr': 'new_mate_hipow'}>
new_mate_cutoff: <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_Cutoff', 'default': 0.5, 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 10, 'precision': 2, 'attr': 'new_mate_cutoff'}> = <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_Cutoff', 'default': 0.5, 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 10, 'precision': 2, 'attr': 'new_mate_cutoff'}>
new_mate_cutout: <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_Cutout', 'default': 0.482143, 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 10, 'precision': 6, 'attr': 'new_mate_cutout'}> = <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_Cutout', 'default': 0.482143, 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 10, 'precision': 6, 'attr': 'new_mate_cutout'}>
new_mate_ztest: <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_ZTest', 'default': 4, 'min': 0, 'max': 8, 'soft_min': 0, 'soft_max': 8, 'step': 1, 'attr': 'new_mate_ztest'}> = <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_ZTest', 'default': 4, 'min': 0, 'max': 8, 'soft_min': 0, 'soft_max': 8, 'step': 1, 'attr': 'new_mate_ztest'}>
new_mate_ztest2: <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_ZTest2', 'default': 1, 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 1, 'attr': 'new_mate_ztest2'}> = <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_ZTest2', 'default': 1, 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 1, 'attr': 'new_mate_ztest2'}>
new_mate_ztest2alpha: <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_ZTest2Alpha', 'default': 0.8, 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 1, 'precision': 2, 'attr': 'new_mate_ztest2alpha'}> = <_PropertyDeferred, <built-in function FloatProperty>, {'name': '_ZTest2Alpha', 'default': 0.8, 'min': 0, 'max': 1, 'soft_min': 0, 'soft_max': 1, 'step': 1, 'precision': 2, 'attr': 'new_mate_ztest2alpha'}>
bone_display_type: <_PropertyDeferred, <built-in function EnumProperty>, {'items': [('OCTAHEDRAL', 'Octahedral', 'Display bones as octahedral shape (default).'), ('STICK', 'Stick', 'Display bones as simple 2D lines with dots.'), ('BBONE', 'B-Bone', 'Display bones as boxes, showing subdivision and B-Splines.'), ('ENVELOPE', 'Envelope', 'Display bones as extruded spheres, showing deformation influence volume.'), ('WIRE', 'Wire', 'Display bones as thin wires, showing subdivision and B-Splines.')], 'name': 'Display Type', 'default': 'STICK', 'attr': 'bone_display_type'}> = <_PropertyDeferred, <built-in function EnumProperty>, {'items': [('OCTAHEDRAL', 'Octahedral', 'Display bones as octahedral shape (default).'), ('STICK', 'Stick', 'Display bones as simple 2D lines with dots.'), ('BBONE', 'B-Bone', 'Display bones as boxes, showing subdivision and B-Splines.'), ('ENVELOPE', 'Envelope', 'Display bones as extruded spheres, showing deformation influence volume.'), ('WIRE', 'Wire', 'Display bones as thin wires, showing subdivision and B-Splines.')], 'name': 'Display Type', 'default': 'STICK', 'attr': 'bone_display_type'}>
show_bone_names: <_PropertyDeferred, <built-in function BoolProperty>, {'name': 'Show Bone Names', 'default': False, 'description': 'Display bone names', 'attr': 'show_bone_names'}> = <_PropertyDeferred, <built-in function BoolProperty>, {'name': 'Show Bone Names', 'default': False, 'description': 'Display bone names', 'attr': 'show_bone_names'}>
show_bone_axes: <_PropertyDeferred, <built-in function BoolProperty>, {'name': 'Show Bone Axes', 'default': False, 'description': 'Display bone axes', 'attr': 'show_bone_axes'}> = <_PropertyDeferred, <built-in function BoolProperty>, {'name': 'Show Bone Axes', 'default': False, 'description': 'Display bone axes', 'attr': 'show_bone_axes'}>
show_bone_custom_shapes: <_PropertyDeferred, <built-in function BoolProperty>, {'name': 'Show Bone Shapes', 'default': True, 'description': 'Display bones with their custom shapes', 'attr': 'show_bone_custom_shapes'}> = <_PropertyDeferred, <built-in function BoolProperty>, {'name': 'Show Bone Shapes', 'default': True, 'description': 'Display bones with their custom shapes', 'attr': 'show_bone_custom_shapes'}>
show_bone_group_colors: <_PropertyDeferred, <built-in function BoolProperty>, {'name': 'Show Bone Group Colors', 'default': True, 'description': 'Display bone group colors', 'attr': 'show_bone_group_colors'}> = <_PropertyDeferred, <built-in function BoolProperty>, {'name': 'Show Bone Group Colors', 'default': True, 'description': 'Display bone group colors', 'attr': 'show_bone_group_colors'}>
show_bone_in_front: <_PropertyDeferred, <built-in function BoolProperty>, {'name': 'Show Bones in Front', 'default': True, 'description': 'Make the object draw in front of others', 'attr': 'show_bone_in_front'}> = <_PropertyDeferred, <built-in function BoolProperty>, {'name': 'Show Bones in Front', 'default': True, 'description': 'Make the object draw in front of others', 'attr': 'show_bone_in_front'}>
def draw(self, context):
215    def draw(self, context):
216        if compat.IS_LEGACY:
217            self.layout.label(text="ここの設定は「ユーザー設定の保存」ボタンを押すまで保存されていません", icon='QUESTION')
218        else:
219            self.layout.label(text="設定値を変更した場合、「プリファレンスを保存」ボタンを押下するか、「プリファレンスを自動保存」を有効にして保存してください", icon='QUESTION')
220        
221        col = self.layout.column()
222        col.label(text="CM3D2 Converter Info")
223        factor = 0.25
224        split = compat.layout_split(col.row(), factor)
225        split.label(text="Add-on Version: ")
226        split.label(text=".".join(str(i) for i in bl_info["version"]))
227        split = compat.layout_split(col.row(), factor)
228        split.label(text="Branch: ")
229        split.label(text=common.BRANCH)
230        split = compat.layout_split(col.row(), factor)
231        split.label(text="Repo URL: ")
232        split.label(text=common.URL_REPOS)
233        split = compat.layout_split(col.row(), factor)
234        split.label(text="Blender Version: ")
235        split.label(text=".".join(str(i) for i in bpy.app.version) if hasattr(bpy.app, 'version') else "Legacy")
236        split = compat.layout_split(col.row(), factor)
237        split.label(text="Blender Language: ")
238        split.label(text=compat.get_system(bpy.context).language or 'None')
239        default_locale = 'UNKNOWN'
240        try:
241            import locale
242            default_locale = locale.getdefaultlocale()[0]
243        except:
244            pass
245        split = compat.layout_split(col.row(), factor)
246        split.label(text="Default Language: ")
247        split.label(text=default_locale)
248
249        self.layout.label(text="."*9999)
250        self.layout.label(text="Preferences:")
251
252        self.layout.prop(self, 'cm3d2_path', icon_value=common.kiss_icon())
253        self.layout.prop(self, 'backup_ext', icon='FILE_BACKUP')
254
255        box = self.layout.box()
256        box.label(text="modelファイル", icon='MESH_ICOSPHERE')
257        row = box.row()
258        row.prop(self, 'scale', icon=compat.icon('ARROW_LEFTRIGHT'))
259        row.prop(self, 'is_convert_bone_weight_names', icon='BLENDER')
260        brws_icon = compat.icon('FILEBROWSER')
261        box.prop(self, 'model_default_path', icon=brws_icon, text="ファイル選択時の初期フォルダ")
262
263        box = self.layout.box()
264        box.label(text="anmファイル", icon='POSE_HLT')
265        box.prop(self, 'anm_default_path', icon=brws_icon, text="ファイル選択時の初期フォルダ")
266
267        box = self.layout.box()
268        box.label(text="texファイル", icon='FILE_IMAGE')
269        box.prop(self, 'tex_default_path', icon=brws_icon, text="ファイル選択時の初期フォルダ")
270
271        box = self.layout.box()
272        box.label(text="mateファイル", icon='MATERIAL')
273        box.prop(self, 'mate_unread_same_value', icon='DISCLOSURE_TRI_DOWN')
274        box.prop(self, 'mate_default_path', icon=brws_icon, text="ファイル選択時の初期フォルダ")
275
276        box = self.layout.box()
277        box.label(text=".menu File", icon='COPY_ID')
278        box.prop(self, 'menu_default_path', icon=brws_icon, text="Initial folder when selecting files")
279
280        box = self.layout.box()
281        box.label(text="texファイル検索", icon='BORDERMOVE')
282        box.prop(self, 'is_replace_cm3d2_tex', icon='VIEWZOOM')
283        box.prop(self, 'default_tex_path0', icon='LAYER_ACTIVE', text="その1")
284        box.prop(self, 'default_tex_path1', icon='LAYER_ACTIVE', text="その2")
285        box.prop(self, 'default_tex_path2', icon='LAYER_ACTIVE', text="その3")
286        box.prop(self, 'default_tex_path3', icon='LAYER_ACTIVE', text="その4")
287
288        box = self.layout.box()
289        box.label(text="CM3D2用マテリアル新規作成時の初期値", icon='MATERIAL')
290        row = box.row()
291        row.prop(self, 'new_mate_tex_offset', icon='MOD_MULTIRES')
292        row.prop(self, 'new_mate_tex_scale', icon='ARROW_LEFTRIGHT')
293        row = box.row()
294        row.prop(self, 'new_mate_toonramp_name', icon='BRUSH_TEXFILL')
295        row.prop(self, 'new_mate_toonramp_path', icon='ANIM')
296        row = box.row()
297        row.prop(self, 'new_mate_shadowratetoon_name', icon='BRUSH_TEXMASK')
298        row.prop(self, 'new_mate_shadowratetoon_path', icon='ANIM')
299        row = box.row()
300        row.prop(self, 'new_mate_color', icon='COLOR')
301        row.prop(self, 'new_mate_shadowcolor', icon='IMAGE_ALPHA')
302        row.prop(self, 'new_mate_rimcolor', icon=compat.icon('SHADING_RENDERED'))
303        row.prop(self, 'new_mate_outlinecolor', icon=compat.icon('SHADING_SOLID'))
304        row = box.row()
305        row.prop(self, 'new_mate_shininess', icon=compat.icon('NODE_MATERIAL'))
306        row.prop(self, 'new_mate_outlinewidth', icon=compat.icon('SHADING_SOLID'))
307        row.prop(self, 'new_mate_rimpower', icon=compat.icon('SHADING_RENDERED'))
308        row.prop(self, 'new_mate_rimshift', icon='ARROW_LEFTRIGHT')
309        row.prop(self, 'new_mate_hirate')
310        row.prop(self, 'new_mate_hipow')
311
312        box = self.layout.box()
313        box.label(text="Default Armature Settings", icon='ARMATURE_DATA')
314        if not compat.IS_LEGACY:
315            box.use_property_split = True
316        box.prop(self, "bone_display_type", text="Display As")
317        if compat.IS_LEGACY:
318            flow = box.column_flow(align=True)
319        else:
320            flow = box.grid_flow(align=True)
321        col = flow.column(); col.prop(self, "show_bone_names",         text="Names"       )
322        col = flow.column(); col.prop(self, "show_bone_axes",          text="Axes"        )
323        col = flow.column(); col.prop(self, "show_bone_custom_shapes", text="Shapes"      )
324        col = flow.column(); col.prop(self, "show_bone_group_colors",  text="Group Colors")
325        col = flow.column(); col.prop(self, "show_bone_in_front",      text="In Front"    )
326
327        box = self.layout.box()
328        box.label(text="各操作の初期パラメータ", icon='MATERIAL')
329        row = box.row()  # export
330        row.prop(self, 'custom_normal_blend', icon='SNAP_NORMAL')
331        row.prop(self, 'skip_shapekey', icon='SHAPEKEY_DATA')
332        row.prop(self, 'is_apply_modifiers', icon='MODIFIER')
333        # row = box.row()
334        row = self.layout.row()
335        row.operator('script.update_cm3d2_converter', icon='FILE_REFRESH')
336        row.menu('INFO_MT_help_CM3D2_Converter_RSS', icon='INFO')
337
338        self.layout.operator('cm3d2_converter.dump_py_messages')
bl_rna = <bpy_struct, Struct("AddonPreferences")>
Inherited Members
builtins.bpy_struct
keys
values
items
get
pop
as_pointer
keyframe_insert
keyframe_delete
driver_add
driver_remove
is_property_set
property_unset
is_property_hidden
is_property_readonly
is_property_overridable_library
property_overridable_library_set
path_resolve
path_from_id
type_recast
bl_rna_get_subclass_py
bl_rna_get_subclass
id_properties_ensure
id_properties_clear
id_properties_ui
id_data
def register():
342def register():
343    pcoll = bpy.utils.previews.new()
344    dir = os.path.dirname(__file__)
345    pcoll.load('KISS', os.path.join(dir, "kiss.png"), 'IMAGE')
346    common.preview_collections['main'] = pcoll
347    common.bl_info = bl_info
348
349    compat.BlRegister.register()
350    if compat.IS_LEGACY:
351        bpy.types.INFO_MT_file_import.append(model_import.menu_func)
352        bpy.types.INFO_MT_file_import.append(anm_import.menu_func)
353        bpy.types.INFO_MT_file_import.append(menu_file.import_menu_func)
354        bpy.types.INFO_MT_file_export.append(model_export.menu_func)
355        bpy.types.INFO_MT_file_export.append(anm_export.menu_func)
356        bpy.types.INFO_MT_file_export.append(menu_file.export_menu_func)
357
358        bpy.types.INFO_MT_add.append(misc_INFO_MT_add.menu_func)
359        bpy.types.INFO_MT_curve_add.append(misc_INFO_MT_curve_add.menu_func)
360        bpy.types.INFO_MT_help.append(misc_INFO_MT_help.menu_func)
361
362        bpy.types.MATERIAL_PT_context_material.append(misc_MATERIAL_PT_context_material.menu_func)
363        bpy.types.RENDER_PT_bake.append(misc_RENDER_PT_bake.menu_func)
364        bpy.types.RENDER_PT_render.append(misc_RENDER_PT_render.menu_func)
365        bpy.types.TEXTURE_PT_context_texture.append(misc_TEXTURE_PT_context_texture.menu_func)
366        bpy.types.VIEW3D_PT_tools_weightpaint.append(misc_VIEW3D_PT_tools_weightpaint.menu_func)
367
368        # menu
369        bpy.types.DATA_PT_vertex_colors.append(misc_MESH_MT_attribute_context_menu.menu_func)
370        bpy.types.MESH_MT_shape_key_specials.append(misc_MESH_MT_shape_key_specials.menu_func)
371        bpy.types.MESH_MT_vertex_group_specials.append(misc_MESH_MT_vertex_group_specials.menu_func)
372        bpy.types.VIEW3D_MT_edit_mesh_specials.append(misc_VIEW3D_MT_edit_mesh_specials.menu_func)
373        bpy.types.VIEW3D_MT_edit_mesh.append(misc_VIEW3D_MT_edit_mesh_merge.menu_func)
374        bpy.types.VIEW3D_MT_edit_mesh.append(misc_VIEW3D_MT_edit_mesh_split.menu_func)
375    else:
376        bpy.types.TOPBAR_MT_file_import.append(model_import.menu_func)
377        bpy.types.TOPBAR_MT_file_export.append(model_export.menu_func)
378        # anm
379        bpy.types.TOPBAR_MT_file_import.append(anm_import.menu_func)
380        bpy.types.TOPBAR_MT_file_export.append(anm_export.menu_func)
381        # .menu
382        bpy.types.TOPBAR_MT_file_import.append(menu_file.import_menu_func)
383        bpy.types.TOPBAR_MT_file_export.append(menu_file.export_menu_func)
384
385        bpy.types.VIEW3D_MT_add.append(misc_INFO_MT_add.menu_func)
386        bpy.types.VIEW3D_MT_curve_add.append(misc_INFO_MT_curve_add.menu_func)
387        # (更新機能)
388        bpy.types.TOPBAR_MT_help.append(misc_INFO_MT_help.menu_func)
389
390        # マテリアルパネルの追加先がないため、別途Panelを追加
391        # bpy.types.MATERIAL_PT_context_xxx.append(misc_MATERIAL_PT_context_material.menu_func)
392
393        # TODO 修正&動作確認後にコメント解除  (ベイク)
394        # レンダーエンジンがCycles指定時のみになる
395        # bpy.types.CYCLES_RENDER_PT_bake.append(misc_RENDER_PT_bake.menu_func)
396        bpy.types.RENDER_PT_context.append(misc_RENDER_PT_render.menu_func)
397        bpy.types.VIEW3D_PT_tools_weightpaint_options.append(misc_VIEW3D_PT_tools_weightpaint.menu_func)
398
399        # context menu
400        if bpy.app.version < (3,0):
401            bpy.types.DATA_PT_vertex_colors.append(misc_MESH_MT_attribute_context_menu.menu_func)
402        else:
403            bpy.types.MESH_MT_attribute_context_menu.append(misc_MESH_MT_attribute_context_menu.menu_func)
404            bpy.types.MESH_MT_color_attribute_context_menu.append(misc_MESH_MT_attribute_context_menu.menu_func)
405        bpy.types.MESH_MT_shape_key_context_menu.append(misc_MESH_MT_shape_key_specials.menu_func)
406        bpy.types.MESH_MT_vertex_group_context_menu.append(misc_MESH_MT_vertex_group_specials.menu_func)
407        bpy.types.VIEW3D_MT_edit_mesh_context_menu.append(misc_VIEW3D_MT_edit_mesh_specials.menu_func)
408        if bpy.app.version < (2,90):
409            bpy.types.VIEW3D_MT_edit_mesh.append(misc_VIEW3D_MT_edit_mesh_merge.menu_func)
410            bpy.types.VIEW3D_MT_edit_mesh.append(misc_VIEW3D_MT_edit_mesh_split.menu_func)
411        else:
412            bpy.types.VIEW3D_MT_edit_mesh_merge.append(misc_VIEW3D_MT_edit_mesh_merge.menu_func)
413            bpy.types.VIEW3D_MT_edit_mesh_split.append(misc_VIEW3D_MT_edit_mesh_split.menu_func)
414
415    bpy.types.IMAGE_MT_image.append(tex_import.menu_func)
416    bpy.types.IMAGE_MT_image.append(tex_export.menu_func)
417
418    bpy.types.TEXT_MT_text.append(mate_import.TEXT_MT_text)
419    bpy.types.TEXT_MT_text.append(mate_export.TEXT_MT_text)
420
421    bpy.types.DATA_PT_context_arm.append(misc_DATA_PT_context_arm.menu_func)
422    bpy.types.DATA_PT_modifiers.append(misc_DATA_PT_modifiers.menu_func)
423    bpy.types.DATA_PT_vertex_groups.append(misc_DATA_PT_vertex_groups.menu_func)
424    bpy.types.IMAGE_HT_header.append(misc_IMAGE_HT_header.menu_func)
425    bpy.types.IMAGE_PT_image_properties.append(misc_IMAGE_PT_image_properties.menu_func)
426    bpy.types.INFO_HT_header.append(misc_INFO_HT_header.menu_func)
427
428    bpy.types.OBJECT_PT_context_object.append(misc_OBJECT_PT_context_object.menu_func)
429    bpy.types.OBJECT_PT_transform.append(misc_OBJECT_PT_transform.menu_func)
430    bpy.types.TEXT_HT_header.append(misc_TEXT_HT_header.menu_func)
431    bpy.types.VIEW3D_MT_pose_apply.append(misc_VIEW3D_MT_pose_apply.menu_func)
432
433    setattr(bpy.types.Object, 'cm3d2_bone_morph' , bpy.props.PointerProperty(type=misc_DATA_PT_context_arm.CNV_PG_cm3d2_bone_morph ))
434    setattr(bpy.types.Object, 'cm3d2_wide_slider', bpy.props.PointerProperty(type=misc_DATA_PT_context_arm.CNV_PG_cm3d2_wide_slider))
435    setattr(bpy.types.Object, 'cm3d2_menu'       , bpy.props.PointerProperty(type=menu_file.OBJECT_PG_CM3D2Menu                    ))
436    
437    bpy.types.DOPESHEET_MT_editor_menus.append(misc_DOPESHEET_MT_editor_menus.menu_func)
438    bpy.types.GRAPH_MT_editor_menus.append(misc_DOPESHEET_MT_editor_menus.menu_func)
439
440    translations.register(__name__)
441    
442    # Change wiki_url based on locale (only works in legacy version)
443    locale = translations.get_locale()
444    if locale != 'ja_JP':   
445        bl_info['wiki_url'] = common.URL_REPOS + f"blob/bl_28/translations/{locale}/README.md"
def unregister():
449def unregister():
450    if compat.IS_LEGACY:
451        bpy.types.INFO_MT_file_import.remove(model_import.menu_func)
452        bpy.types.INFO_MT_file_import.remove(anm_import.menu_func)
453        bpy.types.INFO_MT_file_import.remove(menu_file.import_menu_func)
454        bpy.types.INFO_MT_file_export.remove(model_export.menu_func)
455        bpy.types.INFO_MT_file_export.remove(anm_export.menu_func)
456        bpy.types.INFO_MT_file_export.remove(menu_file.export_menu_func)
457
458        bpy.types.INFO_MT_add.remove(misc_INFO_MT_add.menu_func)
459        bpy.types.INFO_MT_curve_add.remove(misc_INFO_MT_curve_add.menu_func)
460        bpy.types.INFO_MT_help.remove(misc_INFO_MT_help.menu_func)
461
462        bpy.types.MATERIAL_PT_context_material.remove(misc_MATERIAL_PT_context_material.menu_func)
463        bpy.types.RENDER_PT_bake.remove(misc_RENDER_PT_bake.menu_func)
464        bpy.types.RENDER_PT_render.remove(misc_RENDER_PT_render.menu_func)
465        bpy.types.TEXTURE_PT_context_texture.remove(misc_TEXTURE_PT_context_texture.menu_func)
466        bpy.types.VIEW3D_PT_tools_weightpaint.remove(misc_VIEW3D_PT_tools_weightpaint.menu_func)
467
468        # menu
469        bpy.types.DATA_PT_vertex_colors.remove(misc_MESH_MT_attribute_context_menu.menu_func)
470        bpy.types.MESH_MT_shape_key_specials.remove(misc_MESH_MT_shape_key_specials.menu_func)
471        bpy.types.MESH_MT_vertex_group_specials.remove(misc_MESH_MT_vertex_group_specials.menu_func)
472        bpy.types.VIEW3D_MT_edit_mesh_specials.remove(misc_VIEW3D_MT_edit_mesh_specials.menu_func)
473        bpy.types.VIEW3D_MT_edit_mesh.remove(misc_VIEW3D_MT_edit_mesh_merge.menu_func)
474        bpy.types.VIEW3D_MT_edit_mesh.remove(misc_VIEW3D_MT_edit_mesh_split.menu_func)
475    else:
476        bpy.types.TOPBAR_MT_file_import.remove(model_import.menu_func)
477        bpy.types.TOPBAR_MT_file_export.remove(model_export.menu_func)
478        bpy.types.TOPBAR_MT_file_import.remove(anm_import.menu_func)
479        bpy.types.TOPBAR_MT_file_export.remove(anm_export.menu_func)
480        bpy.types.TOPBAR_MT_file_import.remove(menu_file.import_menu_func)
481        bpy.types.TOPBAR_MT_file_export.remove(menu_file.export_menu_func)
482
483        bpy.types.VIEW3D_MT_add.remove(misc_INFO_MT_add.menu_func)
484        bpy.types.VIEW3D_MT_curve_add.remove(misc_INFO_MT_curve_add.menu_func)
485        bpy.types.TOPBAR_MT_help.remove(misc_INFO_MT_help.menu_func)
486
487        # bpy.types.MATERIAL_MT_context_menu.remove(misc_MATERIAL_PT_context_material.menu_func)
488        # bpy.types.CYCLES_RENDER_PT_bake.remove(misc_RENDER_PT_bake.menu_func)
489        bpy.types.RENDER_PT_context.remove(misc_RENDER_PT_render.menu_func)
490
491        bpy.types.VIEW3D_PT_tools_weightpaint_options.remove(misc_VIEW3D_PT_tools_weightpaint.menu_func)
492        # menu
493        if bpy.app.version < (3,0):
494            bpy.types.DATA_PT_vertex_colors.remove(misc_MESH_MT_attribute_context_menu.menu_func)
495        else:
496            bpy.types.MESH_MT_attribute_context_menu.remove(misc_MESH_MT_attribute_context_menu.menu_func)
497            bpy.types.MESH_MT_color_attribute_context_menu.remove(misc_MESH_MT_attribute_context_menu.menu_func)
498        bpy.types.MESH_MT_shape_key_context_menu.remove(misc_MESH_MT_shape_key_specials.menu_func)
499        bpy.types.MESH_MT_vertex_group_context_menu.remove(misc_MESH_MT_vertex_group_specials.menu_func)
500        bpy.types.VIEW3D_MT_edit_mesh_context_menu.remove(misc_VIEW3D_MT_edit_mesh_specials.menu_func)
501        if bpy.app.version < (2,90):
502            bpy.types.VIEW3D_MT_edit_mesh.remove(misc_VIEW3D_MT_edit_mesh_merge.menu_func)
503            bpy.types.VIEW3D_MT_edit_mesh.remove(misc_VIEW3D_MT_edit_mesh_split.menu_func)
504        else:
505            bpy.types.VIEW3D_MT_edit_mesh_merge.remove(misc_VIEW3D_MT_edit_mesh_merge.menu_func)
506            bpy.types.VIEW3D_MT_edit_mesh_split.remove(misc_VIEW3D_MT_edit_mesh_split.menu_func)
507
508    bpy.types.IMAGE_MT_image.remove(tex_import.menu_func)
509    bpy.types.IMAGE_MT_image.remove(tex_export.menu_func)
510
511    bpy.types.TEXT_MT_text.remove(mate_import.TEXT_MT_text)
512    bpy.types.TEXT_MT_text.remove(mate_export.TEXT_MT_text)
513
514    bpy.types.DATA_PT_context_arm.remove(misc_DATA_PT_context_arm.menu_func)
515    bpy.types.DATA_PT_modifiers.remove(misc_DATA_PT_modifiers.menu_func)
516    bpy.types.DATA_PT_vertex_groups.remove(misc_DATA_PT_vertex_groups.menu_func)
517    bpy.types.IMAGE_HT_header.remove(misc_IMAGE_HT_header.menu_func)
518    bpy.types.IMAGE_PT_image_properties.remove(misc_IMAGE_PT_image_properties.menu_func)
519    bpy.types.INFO_HT_header.remove(misc_INFO_HT_header.menu_func)
520
521    bpy.types.OBJECT_PT_context_object.remove(misc_OBJECT_PT_context_object.menu_func)
522    bpy.types.OBJECT_PT_transform.remove(misc_OBJECT_PT_transform.menu_func)
523    bpy.types.TEXT_HT_header.remove(misc_TEXT_HT_header.menu_func)
524    bpy.types.VIEW3D_MT_pose_apply.remove(misc_VIEW3D_MT_pose_apply.menu_func)
525
526    if hasattr(bpy.types.Object, 'cm3d2_bone_morph'):
527        delattr(bpy.types.Object, 'cm3d2_bone_morph')
528    if hasattr(bpy.types.Object, 'cm3d2_wide_slider'):
529        delattr(bpy.types.Object, 'cm3d2_wide_slider')
530    if hasattr(bpy.types.Object, 'cm3d2_menu'):
531        delattr(bpy.types.Object, 'cm3d2_menu')
532
533    bpy.types.DOPESHEET_MT_editor_menus.remove(misc_DOPESHEET_MT_editor_menus.menu_func)
534    bpy.types.GRAPH_MT_editor_menus.remove(misc_DOPESHEET_MT_editor_menus.menu_func)
535
536    for pcoll in common.preview_collections.values():
537        bpy.utils.previews.remove(pcoll)
538    common.preview_collections.clear()
539
540    compat.BlRegister.unregister()
541
542    translations.unregister(__name__)